But I should have said renting is a sunk cost. There is no investment component at all in renting.
I would say low cost index funds are a much lower risk investment than a mortgage. They also have the advantage of being very liquid in the case of actually needing your money. Rent is not a sunk cost, this is a common misconception.
There are many good reasons to buy a home, but do not think of it as an "investment". Compared to other investment options, it's a pretty terrible one.
I highly recommend reading this article to learn more - http://jlcollinsnh.com/2013/05/29/why-your-house-is-a-terrib...
The question is how do you invest the extra leftover money: in home equity tied to the property with running costs, or in other investments (stocks, bonds, your own business)?
A guaranteed zero ROI is better than a negative ROI which you can get with buying a house (e.g. the house you can resell it drops due to the market and you can't afford the mortgage for some reason...)