Bitter gold bugs have been making that argument for the last 50 years...since Nixon took us off the gold standard.
Price of gold in the late 70s was nearly $2,000 an oz. That same $2,000 could have been invested in the market and would probably be worth several hundred thousand today.
So yes, gold is generally a terrible investment. But I do own some as an insurance policy. And that's all it is.
And with interest rates rising, I don't think buying a non-yielding asset like gold is a great idea. Gold should theoretically be at its peak right now, and it can't even break $2k.