You do gain equity when you pay mortgage payments vs. rent payments. But equity comes very slowly, especially in the first few years of a 30 year mortgage. So there's a breakeven point when the equity you've gained makes up for the massive closing costs and points you pay to close the deal. That breakeven point in most areas occurs after about 6-7 years of owning a home.
Even if your plan is to stick around for 10 years, any number of things can happen economically or personally that may cause you to move; in fact, the average occupancy for houses in the US is about 3 years. that means most people end up losing money on their purchases because they never recoup the large closing costs. Renting doesn't have those prohibitive closing costs and if you leave sooner, renting would ultimately have been cheaper in those scenarios.
so yes, -100% on your rent payments but +100% on no closing costs.