Inflation is about the prices people actually pay, on average. Your neighbor's house getting sold for a lot of money isn't a real cost to you like rent. Someone paid that price, but they are not necessarily typical.
Inflation does include rent (or "imputed rent") to the extent that people actually pay those prices on average. Some people really do pay higher rents, but many others have lower housing costs locked in via home ownership or rent control, and they count too, so this is going to drag down the average. That's just the nature of averages.
BTW, stock market indexes are an average too, and it's heavily weighted towards tech firms due to market capitalization. Only about half of the stocks in the S&P 500 are up for the year.