In a foreclosure, I would say the home owner is the biggest loser. The homeowner loses any equity they may have had, and their credit is now trashed. (yes, all money you paid to the bank is gone). The bank is also a loser in the game, but in the grand scheme of things, the bank is going to be just fine. The other losers are everyone else who's affected by lower property values.
Since you are a home buyer, you'll want to avoid the mistakes that all these other people have made. Don't over-extend yourself. Buy something you can comfortably afford. Make sure you have enough money for a down payment and closing costs. (plus extra in savings for anything that might need fixing 6 months from now). Good luck!... more