This is demonstrably false? Long-term average US inflation since 1913 is 3.1% [0]. Long-term nominal average US stock returns since 1928 are 9.94% [1]. A nearly 7% advantage compounded every year for roughly a century is not "slightly above", it is absolutely enormous. Over 60,000% enormous.
Furthermore, when inflation is high, interest rates go up, and interest rates act like gravity on stock prices. See any number of Warren Buffett shareholder letters. See also: the year 2022. Stock market returns are mildly negatively correlated with inflation (with a coefficient of -0.229 [2]).
[0] https://inflationdata.com/Inflation/Inflation_Rate/Long_Term...
[1] https://awealthofcommonsense.com/2025/01/historical-returns-...
[2] https://www.forbes.com/sites/rmiller/2024/06/20/90-years-of-...