http://www.nytimes.com/interactive/2014/upshot/buy-rent-calc...
I analyzed it by looking at the difference between buying and renting, assuming that the difference is invested. So, let's assume that you have a 20% down payment. Scenario 1: buy a house at reasonable interest rate, 30 year fixed. Scenario 2: invest the downpayment and rent, and invest the difference between rent and mortgage payments.
There are a lot of factors to consider here - return on investment, increase in rent, tax considerations, maintenance. I did model these factors, and yes, they make a difference.
But overall, there's one thing that emerges from the model - unless you assume extremely powerful rent control that endures for decades, eventually the mortgage costs less than the rent. As a result, a transition occurs where the owner is now able to invest more than the renter - it can take a while before this happens, but even with relatively favorable inputs for a renter, it does eventually happen. It is possible that the owner won't catch up within this lifetime - if property taxes and maintenance costs are very high, tax benefits to owning are low, investment returns are very high, and the down payment is substantial, it's possible that the renter will build an insurmountable lead. Even if you relax these assumptions a bit, it can take a long time for the owner to surpass the renter in net wealth.
But under most scenarios, I'd say it is better to own, long run. The owner often ends up with a higher net worth even without considering the equity in the house, because eventually the investments catch up once the owner's mortgage is lower than the renter's rent (again, remember we're assuming the difference is invested). The time frame here is very long. You're not going to stop needing a place to live when you turn 50, 60 or 70, after all.
There's also risk to owning: prices could drop, you could have major maintenance issues (hurricane, mold, foundation issues, whatever), the neighborhood could go to hell, etc. So it's not all bubblegum and roses there either.
Point being that there are pluses and minuses to both. The best answer depends on a lot of factors, many of which are specific to a person's situation, and some of which are unknowable.