I am new to REI and I know of a deal that may be going into foreclosure, a third party brought this to my attention. How exactly does a foreclosure purchase work and how could I best approach it?

Would I be paying the back amount that's owed to the bank or is that a separate type of strategy? They currently owe 22k to the bank in back payments.

Thanks