Earnest Money

Does all the earnest money go back to the buyer at closing if the seller pays the closing cost.

Earnest money is normally deducted from the purchase price at closing.