If you stay in your house 10, 20 years or more, buying it is certainly the best plan (unless exceptional circumstances such as Detroit or Baltimore). Less than 10 years? Better do the numbers before: closing costs, property taxes, maintenance works... In many places (not Sacramento, though according to the NYT), you'll only get ahead if your house appreciates several percent every year. Who can be sure of that?
Younger people are more likely to be moving to another place in less than 10 years: better think twice before getting shackled. Again: your mileage may vary, depending on the market and regulation in your country/region. Europeans think a hundred miles is a long way. Americans think a hundred years is a long time.