Mortgage Insurance

Since lenders have homeowners paying Mortgage insurance why are they so worried about having so many foreclosed properties on hand. Dont they get the money back since the homeowners where paying mortgage insurance? Or do they only get a portion back and if so how much do they get back? Thank you.