Jokes can contribute to an evening of gaming by helping to create an atmosphere of relaxed fun.

Jokes can also be used in character to defuse tension when confronted with a potentially hostile NPC.

Or by a definitely hostile NPC to make the captured PCs feel even more desperate about their perilous situation. Think The Riddler
from the old Batman TV show... as if he was in a Christopher Nolan film version...