In Silicon Valley, potential homes buyers frequently weigh buying a home vs. owning stock. JLee Realty posted a video that discusses the benefits of both Silicon Valley real estate and stocks.
A quick visual comparison of Silicon Valley house price growth vs. NASDAQ growth is shown below.

A significant advantage that isn’t shown by the appreciation of Silicon Valley real estate is that a 1031 exchange can be used to delay paying income taxes when changing to a new property. Other advantages include borrowing money at a relatively low interest rate using a mortgage on the home.
Money can be borrowed using a margin loan on stocks but if the stock price drops, you may be forced to sell them even if you believe they will go up. We’ve seen employees who took out margin loans on their stock purchased through an employee stock purchase plan lose their stock when its price dipped.
Read more at https://julianalee.com/blog/silicon-valley-real-estate-vs-nasdaq/