Of course, this opportunity cost only exists if you have the opportunity to choose between two or more locations.
Plus you get to live in it. Plus you get CA amenities (value dependent upon individual preferences, but obviously valued very highly amongst people with money). One of those CA amenities is very worker friendly non compete laws and strict limitations on what employers can claim is theirs, a not insignificant benefit for knowledge workers in my opinion.
People buying $2.75 million homes in Sunnyvale are largely either working (knowledge workers dependent primarily on wage labor) or middle (petit bourgeois; independent business owners and workers with mixed dependency on wage labor and capital investments) class.
I'm far better off buying a $300k house than having $60k in investments but those comparisons become a bit more fuzzy at these 7-figure numbers.
Popular California land is a very unique asset.