My family and I lived in Mountain view for 2 years. We knew we'd only be there for a year or two, and decided to rent, not buy.
After two years, we'd sunk $120K into our rental. Meanwhile, a friend bought a house at the same time for $1.3M and sold it just before we left for $1.6M. Even after real estate commissions, taxes, mortgage interest (which is tax deductible) and upkeep, I'm sure he came out well ahead of us.