I'm so torn on this subject. The management and organization consultant in me says that the court jester in your office will lead in inefficiency and lower productivity. The non-analytical side of me says that every person I've every worked with that brought a smile to everyone's face and broke up the monotony was a godsend. They allowed the staff to take a minute, laugh, breath, reset and get back to work. Sure, some people will go over the line with their humor. Sure, some people will offend others or disrupt the workflow. Just like any other inefficiency, you deal with those people and eliminate them. You DO NOT eliminate the employee with good intentions and great spirit who brings about office unity with their humorous ways. Take this advice with a grain of salt, but mark my words, humor helps. A company I worked with years ago hired a management consulting firm to help deal with some internal issues related to growth, and I'll never forget their suggestion as to how to handle an employee we had that was always joking around: GIVE HIM A RAISE. They suggested that it was good for morale and that it would help alleviate stress for the owners and management if they just laughed at his jokes instead of getting angry at them. Sage advice, in my opinion.
Check out this article (via Forbes) on the correlation between humor and success in business.