In a perfect world the party that defaults forfeits the earnest money to the other party. It's best to contact an attorney to get the specifics about the ins and outs of earnest money.
References
Courtesy of HomeOwners Advantage and link that to their entry in the wiki which is at HomeOwners Advantage