We know D.C. Get our free newsletter to stay in the know.

How often, in the past year or two, have you heard Washingtonians wish aloud that they’d bought a house back when they were cheap, around 2008 or 2009—-or that they’d had the means to buy one? With the median single-family home in D.C. selling for $573,000 in April according to the Office of the Chief Financial Officer—-and the average sale, pulled up by high-end properties, topping $749,000—-homes are now out of reach for many District residents, and a top investment choice for the wistful time-travel set.

But how good an investment have home purchases really been in the past five years? Capital Market Appraisal crunched the numbers using data for the D.C. metro area from the S&P/Case-Shiller Washington, DC Home Price Index. The results are somewhat surprising.

Buying a home in the D.C. area in 2009 certainly wouldn’t have been a bad investment—-on average, it netted buyers a 16.23 percent rate of return through 2013. But it’s also far from the best investment: Putting that money into the stock market would have provided a much higher return of 106 percent.

In fact, the return on a housing investment wasn’t all that much higher than the rate of inflation, which was just more than 10 percent. And over the 10-year period from 2004 through 2013, when the housing market rose and dived and rose again, housing was actually, on average, a negative investment relative to inflation. (According to Zillow, D.C.-area home prices won’t reach their pre-crash peak again until 2021.)

As always, there are a few caveats. First, these numbers measure the housing market in the D.C. area, which stretches are far as Jefferson County, W.Va.; in D.C. proper, the returns would likely be higher, given the city’s recent population surge and cachet boost. Second, many families don’t have the option of putting hundreds of thousands of dollars into the stock market, since they don’t have hundreds of thousands of dollars sitting around. For these families, taking out a low-interest mortgage and investing that money in real estate might actually have been the best large-scale investment available. Finally, while mortgages require hefty interest payments, these are tax-deductible, and homeownership does allow a household to get by without paying rent.

But Americans do tend to overstate the extent to which housing is a good investment, and Nobel Prize–winning economist (and Case-Shiller eponym) Robert Shiller warns of the pitfalls of dumping your savings into a home. Even at a time when housing has seemed like such an obviously good investment in the District, there are reasons to be cautious.

Photo by Lydia DePillis; chart from Capital Market Appraisal