The home you live in is a terrible investment because *you* are paying the mortgage, and the only hope of return is appreciation. A home you allow someone else to live in has a few distinct advantages:
* It need not have the amenities that you yourself demand in your home, and thus can be less expensive to "run."
* You can pick based on a numerical analysis of rents to purchase price, allowing you to select a home that covers all the costs and still provides a stock-market-beating cash ROI. If this isn't possible in your market, buy somewhere where it is possible, factoring in the cost of property management if you don't wish to manage at a distance.
* You can use leverage/financing to put a minimal amount of cash down and immediately begin having someone pay the mortgage off, as well as providing reasonable cash flow beyond costs every month.
Compare House A and House B. Both are 50K. I am living in House A. I am renting out House B. I put 20% down on both. Let's say rent on this unit is $1K a month and for the sake of argument, $250 in mortgage a month and $500 in various expenses to repair, pay taxes, insurance, etc.
House A 1 Month costs:
$250 Mortgage
$500 in Expenses
--------------------
-$750 a month (costs you money every month, only hope is appreciation)
House A 1 Month costs:
$250 Mortgage
$500 in Expenses
+$1000 in Rents
--------------------
$250 cash flow a month (plus you still have the 20% you put down equity, it's not "lost")
Let's say you bought your house all cash-- House A would still cost you $500 a month, but with the same cash you could buy 5 x House B and pocket $1250 a month.
ETA: I know that in both scenarios, you're at least accruing equity, but I'm ignoring that in this example. If anything, it strengthens the argument as someone else adds to that equity in the rental scenario, and you add to it in the "own" scenario.
Above numbers are incredibly simplified, and just intended to illustrate the concepts.
Tl;DR: Your house is a bad investment because you're paying the mortgage and relying on appreciation to make anything. A (good) rental is a good investment because someone else is paying the mortgage and costs, and you're still making money beyond that.