Because housing is typically such a bad investment, it actually only makes sense in some cases because you get your mortgage on margin.
I see this argument all the time but once you do the math, it comes down close to the same with the house being leveraged and index funds without leverage (also known as the 5% rule)