My answers to your questions are assuming you are working with a REALTOR and the house you were trying to purchase was listed by a Real Estate Broker and REALTOR. You should speak with your REALTOR about your particular situation. In order for the Broker who listed the house you were trying to buy to cancel the contract and release the earnest money to whomever it is agreed to give it to, there needs to be a mutual cancellation of the contract document signed by the purchaser and the seller. That document when signed will cancel the contract. If your contract to purchase the house was a normal type of contract with the purchase of the house contingent upon your being able to get a loan to purchase and you were denied the loan, then normally the contract is written for you to be able to get your earnest money returned to you. So it is unclear from your question why the earnest money is not being returned to you but each contract is different and circumstances are different so you should speak with your REALTOR who can help you with your situation.