If you getting a house on good price then it's always better to buy a house rather than renting. Buying house is like investment as you can good cash back when you going to sell even in the future but paying rest is not an investment, it's only comes in expenses.
Buying is not always better than renting, and above all - it is not an investment since buying a house a living there will not bring you revenue. Buying a house and renting it to someone brings a revenue. That makes it an investment, but not necessarily a good one.
Answering the question if it is better to buy or rent, or if it is a good investment to buy a house and find a tenant takes calculation - not gut feeling or historical data.
If house prices increse with 10% when inflation is 2%, income in general increse 3% per year and mortgage interest is 4% it is vastly profitable to buy a house with borrowed money. On the other hand, if houses increse 8% on top of inflation, that mens the house would double in real value nine years, triple in 14 and cost 500% more than today in real terms after 21 years. Who would buy a house in 21 years for five times in real value of today, if income during that time increse by 23% (1% per year on top of inflation). The answer is no one. The most extensive statistics on house prices (from Amsterdam, from 15:th century to this day) show that they track income very closely. The exception seems to be the time of massive credit expansion of late 1990:s up until 2008. Never expect houseprices to increse faster than income in general.
Since mortgage interest rate in a sound economy (few parts of the world are today) will always outrun the pace of increasing income (to limit inflation), buying a house financed with >85% debt will surely bring a net finance cost. Add to that the running cost and maintenance of the house. Owning a house means a risk, more so if you have a mortgage. Those risk you avoid by renting, wich should transfer to a bit higher monthly cost.
I rent a home for $143 per square meter and year, including heating and maintenance. The actual running cost and maintenance cost (the landlords financial statements is public) is something like $60-70. Now, buying a home like the one I rent around here cost something like $4.500-5.600 per quare meter. That means I pay the equivalent of 1,3-1,8% interest rate on the potential value of the home. Given interest is 30% deductible in Sweden, the actual figure is 1,86-2,57%. Pretty good deal.