There really is no such thing as "earnest money" because if one backs out of the deal, in reality the money will be returned. I know this from experience.
My friends who were realtors told me that if I didn't choose to refund the money, the house would be tied up and therefore it was in my (the seller's) best interests to just refund the money even though technically, there had been an offer and acceptance.
I guess one could choose to keep it -- and certainly I wouldn't recommend that a buyer put down money with the offer thinking they could rescind the accepted offer and get back the money.
However, my experience (backed up by my realtor friends since I wasn't willing to trust the realtor I was working with in Orange County) was that the money is returned because until it is you are in limbo with the house.
Some days I pray for Silence, Some days I pray for Soul,
Some days I just pray to the God of Sex and Drums and Rock 'N' Roll.