(a) Except as provided in subsection (b) or (c) of this section, an entity that is liable with the debtor on, or that has secured, a claim of a creditor against the debtor, and that pays such claim, is subrogated to the rights of such creditor to the extent of such payment.
(b) Such entity is not subrogated to the rights of such creditor to the extent that—
(1) a claim of such entity for reimbursement or contribution on account of such payment of such creditor’s claim is—
(A) allowed under section 502 of this title;
(C) subordinated under section 510 of this title; or
(2) as between the debtor and such entity, such entity received the consideration for the claim held by such creditor.
(c) The court shall subordinate to the claim of a creditor and for the benefit of such creditor an allowed claim, by way of subrogation under this section, or for reimbursement or contribution, of an entity that is liable with the debtor on, or that has secured, such creditor’s claim, until such creditor’s claim is paid in full, either through payments under this title or otherwise.