In places like the Bay Area, property values pretty much never go down in price, and the YoY relative increase is on par with that of index funds. Combine that with rental income, and you can very likely beat an index fund. Mortgages offer much more leverage than margin loans, which helps offset the upfront capital cost.
For decades, property values kept going up in Detroit until they didn't.