I'm still a bit pissed about MattY's housing post from a few days back, mostly because of this weird recent notion that housing is a crappy investment (usually accompanied with comparisons to stocks). It makes me want to bang my head against a wall.
Let's get around the first issue about housing as an investment: what could that even mean? There are three ways to see housing as an investment. The first is as a rental property. The second is as a flip (buy, maybe renovate and sell). The third, and most common is a combination of inflation hedge and forced saving mechanism. The "value" of a house is relevant to the first one only for the initial purchase. Once the house is owned and being rented, fluctuations in housing price are irrelevant. Similarly, once you've bought a house you plan on living in for many years, you shouldn't really care if it's theoretical value moves around any. In both of these two cases your investment relates to rent vs. purchase cost. If you are renting to someone else that is easy: ($ in rent - costs)/purchase price is the approximate return. Yes, at some point you may want to sell the house, but mostly you are looking at a simple calculation for investment return that has nothing to do with changes in valuation.
If you are living there, then you are actually looking at the same math. Note: having a mortgage is largely irrelevant in either case (it goes to costs but reduces your purchase price so you tend to end in the same place).
About the only person for whom value matters (after purchase) is the flipper, and in that case the investment issue is far more complex, and, frankly, more random. This is the high risk/high reward category of housing investment.
If you insist on making a direct comparison, then housing as investments should be compared to [inflation protected] bonds rather than stocks: mostly holds its value and provides a steady stream of "income" (real income in the rental case, forced savings in the owner occupied). In this comparison housing is probably the better investment.
Really, though, for the owner-occupied housing as investment, the value is much greater. This is because, again, you have to live somewhere, and there is a cost for that. Yes, you can live in some dirt cheap flat and save lots of money over buying a (most) house(s), but most people--and pretty much anyone who is concerned with investing--don't do this. For most people the choice is between buying a house and renting a house/apartment with similar amenities. In all but a few select locations in this country there isn't a huge gap in the monthly cost for the two. Housing is more upfront, but grants both forced savings and inflation protection. Renting is low to zero cost upfront, but provides $0 in terms of investment return. The only reason to rent instead of buy is if the cost difference is enough to offset the rather large lifetime return of owning a house. In San Francisco and NYC that may well be true long term. For short terms (up to a max of maybe 7 years) that may also be true. For most other people and places...not even close. Some places it is cheaper to buy a house live for a year and sell that it would be to rent something comparable.