Were there ultra low fee index funds in 1981, which automatically reinvested dividends?
Also, to be a true apples to apples comparison, the excess rent over expense would also need to be “reinvested.” Otherwise you are giving the S&P 40 years of compound interest but no interest whatsoever counted in favor of the housing investment.