The joke:
How much do roofs cost! Nothing, they're on the house
Here is the breakdown:
1. The Literal Meaning
In the world of real estate and construction, if something is "on the house," it means it is physically located on top of the building. Since a roof sits directly on top of a home, it is literally "on the house."
2. The Idiomatic Meaning
In restaurants or bars, the phrase "on the house" is a common idiom meaning free of charge. The business is paying for it, so you don't have to.
The Punchline:
The joke tricks you into thinking about the location (on top of the house). But it's also talking about the price (free).