Pretty much every famous author in history sneaks at least one silly and hilarious joke into their work, and for my first example I'm going to use one of my favourite authors- Arthur Conan Doyle. As I'm sure you know, Arthur Conan Doyle created Sherlock Holmes (one of my favourite fictional characters). I'm sure you must think that they're those serious dramatic detective stories from the 19th century don't you? Well you'd be wrong if you did. These stories often have moments in them that're very funny, but to keep this entry short I'll give only one example. In the Sherlock Holmes short story 'The Adventure of the Red Headed League' a ginger man comes to visit Holmes to tell him about a crime that seems to be linked to a gang of ginger headed people (The Red Headed League) who supposedly come together for no reason other than that they're all ginger. When this ginger man finishes telling Holmes and Watson about this little ginger gang, all they can do is laugh in his face about how silly the whole thing is...
But I suppose Sherlock Holmes is at least moderately recent, how about something from Shakespeare? I'm sure you think that any humour in this is completely lost due to the fact that the language used in it is now so antiquated. Well you're wrong again. In 'Richard III' Richard is confronted by a woman for his murderous ways and all he can do is flirt with her, making totally unsubtle suggestions that she should just be quite and come and have sex with him (and when I say unsubtle, I really mean it. Sexual innuendos usually go completely over my head, but even I noticed them here...).
To go even further back in time, and to show that there's fun things even in books that aren't fictional, for example The Republic by Plato. The Republic is supposed to be a hypothetical debate between Plato's dead best friend Socrates and several other philosophers, covering subjects such as politics, morality, the nature of existence and other very serious subjects... Until they all stop to imagine naked old ladies working out at the gym, they find it quite hilarious as it happens.
To give another non-fictional example, I'll use The Bible (I know some people would like to argue that The Bible belongs purely in the fictional section, but I'd class it as a history wrapped in poetry and mythology, with a highly controversial label of 'divine inspiration' sitting in the maybe pile). Now, I'm not 100% sure if this example is something that was intended to be funny, but it is anyway, so I'll include it. Basically, an enemy tribe is preparing to attack to Israelites... Luckily for them, God sneakily kills them all in the night to protect them, and after he's killed them all, it says this "And sure enough, when they awoke the following morning, they were but corpses" make of that what you will.
These are just three small examples, but really people shouldn't have such a negative and boring perception of books, especially those which were written long ago. I'm sure that no writer has ever lived who resisted the temptation of putting silly jokes into their work.