Your example assumes that monthly rent = monthly mortgage, when in many cases, rent will be lower. But even if they were equal, and you are putting $300/mo to equity in your example (10k over 3 years), you still need to overcome the loss your are taking with closing fees and the 6% you will have to pay when you sell. Maintenance costs of owning a home are also higher than rent, sometimes considerably. And what if, when you move, you aren't able to sell your home right away? For each month your house is on the market after you leave, you are wasting $900/mo. You will never see that $900/mo again. If you decide to keep your house and rent it out, don't forget, you don't get to just bag that $1000/mo in rent you receive. You'll have to pay about 10% to a property manager since you'll be gone, maintenance fees, your property tax on your house will likely increase since it is now an income property, and you will have to pay income tax on the rent you receive. You'll be taxed at your highest bracket, probably 25%-30% for most people here, since it's all additional income. And don't forget, your rental property won't always be occupied. There will be times when it'll be vacant, and you'll be soaking up the entire costs.
Bottom line is, will you have more money in the long run if you buy or rent? It depends on how long that run is. For most military people who move every 3 years, you are better off renting in most cases. But, if you have a family, sometimes buying a house is a necessity, for the extra square footage/garage/yard for the kids, etc.