Normally if a borrower is foreclosed upon or a loan is modified due to a possible foreclosure, that reduction in debt is considered income and is taxable. Thanks to the Mortgage Forgiveness Act of 2007, that income is not taxable. The law covers foreclosures and modifications that occur in the years 2007-2012. Up to $2,000,000 can be excluded per year. Commercial real estate is excluded, as only primary residences are included in the act. The relief can be claimed using IRS form 982.
As always, consult your accountant or CPA.