@Eddie Werner
There are a lot of different takes on this topic, with varying application to specific situations. A person's age, income, tax bracket and goals all fall into play and there is no one set answer.
It seems from this thread that we are comparing a conventional market based 401k to investing in real estate, and that is like comparing a Yugo to a Porsche.
If you are stuck in an employer plan, then you do not have much in the way of investment options. If however, you already have significant tax deferred savings in a former employer 401k or an IRA, then you can have the best of both worlds - a tax sheltered retirement plan that can invest in real estate. That would be a self directed IRA or Solo 401k, perhaps with a Roth focus.
For those who are actively investing in real estate - flipping, wholesaling, etc - and creating earned income as a result, there can be benefits to establishing a self directed Solo 401k that allows you to take the earned income from those activities and shelter some into a plan to reduce your tax profile. This does not apply to passive rental earnings, however.
So, lots of ways to look at these topics, and lots of ways where a careful planning of investment and tax strategies can put more money in your pocket.