The funny thing is we tell jokes all the time, but in stories, people almost never tell jokes. However, if you're reading a story in which someone does tell a joke, it's not really a joke.
I believe this may be an iron-clad rule of writing such as if a gun appears in the first act, it must be fired by the third.
In The Second Coming, there are at least a couple of characters who tell jokes. For Percy, who is very interested in the uses of language, the jokes are not interesting for their content, but for the way they're told and what they reveal about the relationship between the teller and the audience. When you think of it, a joke is a very peculiar speech act. Here is a genre of conversation in which one person will tell a story, with plenty of markers along the way to identify it as a joke, and others will listen without interruption, so that they will laugh at the end. In Percy's novel, jokes seem flat-out acts of aggression - covert aggression, socialized and normalized to seem like cheerful conversation, but in the joke the teller achieves dominance and has the power not only to hold center stage but inflict racist or otherwise objectionable notions on the audience, expecting to receive a tribute of laughter at the end.
In one of Gore Vidal's novels, I forget which, I think 1876, there is a joke that I recall well enough to record here. (Being in the Joke Biz myself, I have a good memory for this sort of thing.) "Q: How does the devil ice skate? A: How in Hell can he?" The novel's narrator, a convenient spokesperson for Vidal, observes the purpose of the joke is to allow well-bred gentlemen to get away with saying "hell" in front of the ladies. The joke does get a general laugh from its shocked and amused listeners.
In Patrick O'Brian's books, there are frequent execrable puns. One of these - "the lesser of two weevils" - made it to the big screen in Master and Commander, but OBrian handles the seaman's love of labored puns much more deftly than the movie. They're discussing the works shifts, called watches, aboard ship, and wondering why the shortest of these is called a "dog watch." "Because it's cur-tailed," Maturin explains, and after a certain pause while the sailors decode this pun, there is general laughter. The payoff, though, comes when Aubrey repeats the same joke at a dinner featuring some high-ranking navy brass. O'Brian exquisitely captures Aubrey's tension at rendering the joke correctly - which he manages to do - and a lovely portrait of manners and mores and human nature is given. You can't be funny if you're trying to be, and yet trying to be funny is funny.
There are a couple of jokes in a Gilbert and Sullivan operetta (Yes, I know Gilbert and Sullivan is LOADED with jokes, but the characters never know they're making them. A misunderstanding between "orphan" and "often" is just confusing to the characters, only the audience groans at the pun.) I can't remember the name of the piece, but it involved a professional jester, who, of course, never makes a joke that's the least bit funny to the characters or the audience.
In my own stories - and you were wondering when I'd get around to them - jokes serve thematic and foreshadowing purposes. Earl's father in Endless Corvette asks a riddle that foreshadows his own grisly death at the end, and in Paradise Dogs, Adam tells a joke - he tells it twice, once in the beginning and once towards the end - that reveals his own modus operandi in life.
Trying to think of a way to close this blog, it occurs to me to try composing a meta-joke.
Here it is.
So there's an airplane with a German, a Mexican, and a Catholic. And the German says, "Did you hear the story about these three people who die and go to heaven? At the pearly gates, Peter says, 'Before I let you in, I got to tell you this story about Moses, Jesus, and Muhammed playing golf. Well, they're on the 18th green, when Moses says, 'Did you hear the one about...?"
Well, you get the idea.