If a person were to pay 120k for a house and sell it at 145 2 months later, but only make 5k profit after realtor fees are paid?

Would the person have to pay capital gains tax on the 25k he made on paper or the 5k he actually made in hard cash after closing fees were paid?
12 answers 12