(a) A subordination agreement is enforceable in a case under this title to the same extent that such agreement is enforceable under applicable nonbankruptcy law.
(b) For the purpose of distribution under this title, a claim arising from rescission of a purchase or sale of a security of the debtor or of an affiliate of the debtor, for damages arising from the purchase or sale of such a security, or for reimbursement or contribution allowed under section 502 on account of such a claim, shall be subordinated to all claims or interests that are senior to or equal the claim or interest represented by such security, except that if such security is common stock, such claim has the same priority as common stock.
(c) Notwithstanding subsections (a) and (b) of this section, after notice and a hearing, the court may—
(1) under principles of equitable subordination, subordinate for purposes of distribution all or part of an allowed claim to all or part of another allowed claim or all or part of an allowed interest to all or part of another allowed interest; or
(2) order that any lien securing such a subordinated claim be transferred to the estate.