For purposes of part II of subchapter F of chapter 1 (other than section 508(a), (b), and (c)) and for purposes of this chapter, a trust which is not exempt from taxation under section 501(a), all of the unexpired interests in which are devoted to one or more of the purposes described in section 170(c)(2)(B), and for which a deduction was allowed under section 170, 545(b)(2), 642(c), 2055, 2106(a)(2), or 2522 (or the corresponding provisions of prior law), shall be treated as an organization described in section 501(c)(3). For purposes of section 509(a)(3)(A), such a trust shall be treated as if organized on the day on which it first becomes subject to this paragraph.
The Secretary shall prescribe such regulations as may be necessary to carry out the purposes of this section.
If any amounts in the trust are segregated within the meaning of subsection (a)(2)(B) of this section, the value of the net assets for purposes of subsections (c)(2) and (g) of section 507 shall be limited to such segregated amounts.
The provisions of section 507(a) shall not apply to a trust which is described in subsection (a)(2) by reason of a distribution of qualified employer securities (as defined in section 664(g)(4)) to an employee stock ownership plan (as defined in section 4975(e)(7)) in a qualified gratuitous transfer (as defined by section 664(g)).