And if you are buying in Australia you have this nightmare called "Stamp Duty" - as in "stamp on your head and rob you blind" duty which can run to 5% or more. So closing costs on a $500k house (yes - houses are expensive here):
To buy
House price : $500,000
Legals : $1,500
Bank Fees : $1,000
Inspections : $ 800
Stamp Duty: $20,000
Total: $523,300
To sell a $500K house
Legals : $1,500
Agent Fees : $15,000 [3% is common at this price point, 5% is common for lower value deals]
Advertising : $5,000 [big scam here - agents charge you full price to place newspaper ads then get substantial rebates from the newspapers which they keep]
Bank Fees : $1,000
Total : $22,500
So the round trip to buy and sell a $500K house is around $45K - 9%.
You can trim the agents fees by selling yourself. This isn't a good idea if it is your own home due to the emotional attachment. It also isn't a good idea if you have limited negotiation skills. However, not many agents have good negotiating skills in my experience. We were very, very picky hiring our agents and out of 4 sales we had 2 good guys, one legend and one total dud. We had to lead the last guy by the nose through the whole negotiation process and got another 13% above what he was pushing us hard to accept.
So there are a couple of lessons in all this. First, property transaction costs do represent a sizeable chunk of the value of a property so do your numbers and plan to hold for a while (rule of thumb comment from arebelspy holds). Second, a poorly sold property bleeds as much or more value than the transaction costs so make sure you invest time and effort into preparing the property for sale, finding a competent agent, marketing it properly and negotiating well. One moment of weakness in a negotiation on a $100k property could easily be worth $5k. Some psychological defect in humans makes big numbers appear small in this context and it is easy to give too much away if you aren't concentrating or you go too fast. Also, you aren't just negotiating with the buyer - you are negotiating with the agent in this situation. They want to get the property sold, take their commission and move on to the next one. Pushing for a higher price slows down their deal rate and they make less money so there is a natural conflict of interest.
BTW - one reason to buy rather than rent, even if you are in it for a short time, is to add value through DIY rehabbing etc. If you enjoy that kind of thing then it's fun to do it on your own place and you can do quite ok financially if you plan it out right.
BTW #2 - I chuckled a little when I saw the "very high capital gains tax rate" comment. 39.6% is high, but top marginal rate for short term capital gains (and normal income) in our part of the world is 46.5%. But then we do have good health care ;). And education.