A loan policy aka mortgage title insurance protects the mortgage lender so long as they have an interest to protect. The interest of the mortgage lender expires when the note is paid in full and the mortgage is satisfied. If, however, the mortgage lender must foreclose, the loan policy converts to an owner policy for the lender and will protect them so long as they have an interest to protect.
So, let's say a mortgage lender forecloses and ends up owning the property, attempts to sell it a new buyer and that buyer's title agent finds a title problem which precedes the issuance of the loan policy. The mortgage lender could make a claim even though their original insured mortgage was divested in the foreclosure.
Consumers should take heed that a loan policy benefits the mortgage lender only. Your interests and the interests of the mortgage lenders are not the same. If you want protection, you must purchase an owner policy.