Actually, even if you sell the place at the same price you bought it for, you'll probably still end up better off. If you rent, you're basically flushing your money down the toilet. If you buy, you pay the bank, and then when you sell, minus the interest and the agents' fees, you get your money back, and you'll have lived for free for that time period. If you're able to buy a place with a few small fixable issues, you could improve it slightly (or a lot), and sell it for more, even in the case that property value stays the same. The main thing to watch for is the area; otherwise very nice houses are limited by the surrounding houses / neighborhood. So, a very nice house in a poor neighborhood is worth less than a poor house in a very nice neighborhood.
You're only in trouble if the property value goes down. Other than that, assuming nothing terrible happens (your roof gets ripped off, etc.), you're almost certainly in a better position if you buy vs. rent. Think about it - if renting wasn't profitable, no one would do it. So, not only are they making money off your rent each month, but by the time you leave, all your money is gone, and you have nothing to show for it.
If possible (generally speaking, and not taking into consideration special circumstances) my impression is that as a rule, if possible, buy rather than rent.