Also, I was considering a number of tail risks in our decision. For example, I'd bet that the house in the Bay Area will be worth roughly $0 in 40 years, because:
1.) Tech will have run its course, leading to a Detroit-like situation where everybody moves out and you can't sell what you've got.
2.) The housing stock here is objectively terrible by the standards of anywhere else in the country - many were cheaply built in the 1950s to 1970s, and they need major repairs and upgrades now, let alone in 40 years. Friend of mine was recently buying and was like "I offered $279K over asking on a house that needs at least $100K of repairs", and he didn't get it anyway.
3.) Termites are endemic here. Every house has termites and few of them have concrete basements. There's a good bet that the house you just spend $2.7M on doesn't actually have a foundation.
4.) Earthquakes and wildfires. The big tech companies assume that there is a 100% chance that the Bay Area will be hit by a major earthquake in the next 30 years; I don't see why I should assume any differently.
Buy scenario, free maintenance and no property taxes: Living in a $2.7M house means a downpayment of $540,000 plus $6.6k/month of mortgage (assuming 2% interest rate on ~$2.2M mortgage paid over 40 years). Your housing prices increase 6%/year on average (1985 - 2015 average, http://www.doctorhousingbubble.com/california-housing-histor...). You sell 40 years later your house for $22,628,579.
Rent scenario: You put your $540,000 plus $4400 per month into your average stock market. 1985 to 2015 the performance was more than 10% per year (http://www.moneychimp.com/features/market_cagr.htm). Let's say you're conservative and you go for 6%/year in growth. In 40 years your net worth is $77,737,237.02.
Renting is definitely better than buying in the scenari outlined in grandparent's comment.