This was a change in late 2007 about this, due to something called the "Mortgage Forgiveness Debt Relief Act of 2007" ... it's tricky, as per usual, and doesn't apply to everyone, but this particular kind of tax -- the ordinary income due to forgiveness of debt in a foreclosure, can in some cases be avoided if it results in a Title 11 filing; it triggers other things, like a change of basis that might leave you with a gain. IANATABIPOOTI. There was an earlier program that was related to excluding this income when people walked away from mortgages on un(der)insured houses as a result of Katrina, but that expired in 2006.
/jordan