The trick for the writers is to come up with something that is funny, but not offensive.
The humor usually comes from the idea that whatever comedic bad thing that happens on the show’s funeral episode, does not actually happen in real life.
In real life, people at funerals act with proper, sober behavior.
However, that is not always the case as Business Insider attests to in "I'm a funeral director -- screaming fights, drunken propositions, and blasting Nirvana are all part of my job."
The author of the article is a funeral director.
He goes through the many incidents of people acting inappropriately at wakes and funerals. He includes everything from a woman showing up in a bikini, people ordering pizza, to family members getting into fights and much more.
He was even propositioned once by the deceased's drunk granddaughter.
While this might seem like a small issue, it is something that families should consider making sure it does not happen at their funerals. Bad behavior at funerals can lead to fights that spill over into handling the deceased's estate, which are not at all as funny as television comedies might portray.
Reference: Business Insider (July 25, 2017) "I'm a funeral director -- screaming fights, drunken propositions, and blasting Nirvana are all part of my job."