That isn't inflation. Inflation is about consumables. If the valuation of assets rise, that is actually the opposite: If you sell the asset, the returns can buy you more consumables.
And neither S&P nor NASDAQ had anything resembling rampant gains, BTW:
In the last ten years the NASDAQ index went from 2.000 to 8.500 and the S&P500 from 1.000 to over 3.000 in what is generally referred to as the "10 year rally".
Inflation as in the rise in price of a basket of goods is generally used in reference to the consumer price index, but can also be used in reference to stocks, and baskets of those such as the indices.
And before S&P went from 400 to 7000 largely uninterrupted, and NASDAQ from 350 to 7100. But as those are compounding values (i.e. there is not a linear realationship between year n and year n+1, but an exponential one) one can gain more insights from comparisons of the annual returns - that is the reason why I linked those. The annual returns are not unusual, though. Please have a look at them!
If the prices of assets rise, that is appreciation. If stocks or houses appreciate, you can sell them and profit: Your purchasing power rises. If consumables experience inflation, you can not sell them for a profit: They are either immaterial, like services, or can rot, like food. This isn't pedantry, these are different concepts.