I've owned a house. Or rather, I've had a mortgage on a house. I spend a bunch of money each month. After some number of years, I owned some fraction of the house.
I've rented. I spent a bunch of money each month. After some number of years, I owned precisely nothing.
So that's how it's an investment. On the other hand, what I'm primarily buying is a place to sleep each night, not an investment. So in that way, it's not.
And methinks the biggest "investment" value of all: when you own it outright (may I recommend you suck it up, get humble, and pay cash up front), it's yours and nobody can evict you. Knowing you'll have a safe place to sleep is huge. Yeah, property taxes exist (far less than rent, which you're paying in your rent anyway), and eminent domain may screw things up (unlikely if you choose wisely), but it's far better than risking receipt of a notice saying "sorry, but we've sold the building which will be demolished next month".
If nothing else, buy a $10,000 property somewhere (see zillow.com) and DIY build a $20,000 small house on it (lots of options available, search "tiny house"), cash as you go. If I'd have a do-over, I'd go that route no question.
Most young adults are none of these.