Did you account for leverage? I agree with you all the way, however, the top reason it can actually be beneficial to most people is the fact, that they can leverage their money.
Putting it a bit simple, it would mean, that for most people, ncr_(real estate)^t > c*r_investing^t
It all depends where in the world you are, but most places have easier access to loans for real estate than investment, and everything else being equal, the risk is also higher.
There might be this line of thought in wake of the financial crisis, that real estate carries close to or as much as the same risk. It doesn't. It's just not zero, and that is the lesson learned.