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...
Transcript
{The control room where the droids stayed}
[SFX]: Knock knock
C-3PO: Who's there?
Clone Trooper: {from far side of door} Clones.
C-3PO: Clones of who?
R2-D2: Whom.
{beat}
Clone Trooper: Um. Clones of someone who is terrible at knock knock jokes, sorry.