With a mortgage, you are forced to save money. In other words you have no way around being disciplined. So yes in theory you could probably make more money with aggressive investing, but chances are most people would risk too much and lose a lot and never have the mental discipline of saving the excess they have no matter what happens in their life.
Only on paper.
You can borrow from your property’s value by neglecting maintenance, and that is sometimes even harder to notice than dollars in a bank account.
This is one of the ways condo ownership can bite you.
And then hope you're not one of the ~1/3 that end in a divorce at which point your house gets firesold to first low-balling flipper. House can be really bad anytime it's multiple people liquidating it -- I watched some other family members inherit a house and it sold for about half it's value because some family members weren't willing to wait more than a millisecond for the inheritance payout.
I made plenty of money (and still do) holding US treasuries and other safe investments. You don't need to gamble on stocks to have income from cash which offsets rent.