This is actually a little bit of an area of expertise of my own.
Check with your agent - ask him/her to bypass the listing agent for this ...
Have your agent contact the the title company and get the bank's contact info that owns the home. Since it's in foreclosure, it qualifies for a "short sale". This is where the bank will entertain offers directly to them on the house in question. If they are open to offers, have your agent contact the listing agent and advise them that you're wanting to make an offer directly to the bank. That agent should be the first to get the appropriate paperwork/information from the bank if he/she wants a commission. Make your offer and submit.
A short sale is only possible on bank owned foreclosures, or homes that have been under "hardship" through the bank or financial institution that owns the deed. It's where a bank weighs how much is left owed vs. what they would accept from YOU to keep from having to hold the home in limbo, or auction it off for a huge loss. A bank does NOT want to own homes. If they can get a reasonable offer from you (less commissions from both agents) often times it's much more beneficial to the bank to accept your offer rather than auctioning it off. The savings is passed onto you. Your advantage here is that a bank actually owns it, if it were a private party or flip pro - you wouldn't have a shot in the dark. In certain circumstances, it could be made even more attractive to the bank that owns the home if both agents forfeit .5% - 1 % of their commissions. In a lot of cases it's just enough to make the sale to the bank, and they still get paid. These are tough times and may be open to being creative like that.
But be careful. KNOW the bottom line - and what the fair market value of the home is. Your agent should have already done this homework with comps in the area. But with the market the way it is ... what's left owed on the home may be far more than the current market value and that is a risk you DO NOT want to take You will become a statistic. Because we cannot foresee the future in the market. It's a huge gamble if you took that sort of risk. If the economy improved and went back to normal overnight, you could actually make a few bucks, but we all know that is NOT going to happen. BE CAREFUL !!
On a side note, it's fundamentally the same no matter where you are. You should get every penny of your earnest money back. The inspection fee however - well you nailed it. Small claims. And depending where you are, that could be tough as some districts charge upwards of $3k to even file small claims anymore. And chances are you've only got about $400 wrapped in inspection fees at this point (Whole Home Inspection). The seller should have covered the pest and dry rot.
If you need anymore advice, give me a ring brother. I did this sort of thing for 10 years and I was one of the few that didn't lose my shorts in the end. Instead cancer got us
But it's a pretty good reference nevertheless
best,
-Chris