The lender will most likely not bid above fair market value which is most probably less than what would make the lender whole.
You may be correct if the sheriff is conducting an open auction. In that case, the lender will have no reason to preclude a winning bid from a third party. If it is a blind auction, the lender will submit a bid that is consistent with the balance of the defaulted debt, purchase the home and proceed with marketing the REO.
Perhaps you should go look up what a 'blind' foreclosure auction is. Thank you.