Because the line between humour and either horror or pathos is a very fine one, and if crossed correctly, it can make for a very entertaining film or play.
The concept does not appeal to everyone, but I am a big fan.
You find yourself laughing when yiou telll yourself that what you are watching is not funny, but you laugh anyway.
Want an example? Watch 'Shallow Grave', one of the finest black commedy films I;ve ever seen.