To avoid cherry-picking, if we go out to 20 years housing has an average annual return of 4%, and the S&P 500 is at 6%. Go out 30 years and housing hits 5% while the S&P is at 10%.
PS, I really appreciate the Case-Schiller index used above for housing prices. It's methodology specifically targets the change in value of a house, instead of capturing overall price increases caused by house flipping, the expanding size of houses over time, etc.