If no one bids for it, Bank A will "buy" it at the loan amount, then negotiate with XYZ to clear these other loans, hold a clean title as REO, then market it again.
This is my understanding.
Unless you know what you are doing, I do not recommend to buy at the court auction.