I don't see any problem here insofar as we shouldn't have one law for wealthy companies and another for everyone else: the mortgage company screwed the legal pooch, so now they have to pay the consequences like everyone else.
In addition, it's likely the bank was paid off by PMI a long time ago-- its probably the insurer and the servicing company left holding the bag.
It was still stealing. She can equivocate and stand on “the law” all she wants, but it is getting something you did not earn and did not intend to earn.
BTW, PMI is paid by the homeowner to protect the lender. She didn’t make any mortgage payments, thus no PMI.
Regardless, the IRS will get her, too. You’re right. It is a capital gain and she can’t claim an exemption unless she sells the house, and I doubt anyone would see that place having a ‘clear title’.