Both government agencies and non-bank lenders incur losses on foreclosures