of such portion under subpart E of part 1 of subchapter J of chapter 1, all assets attributable to such portion at such time shall be treated for purposes of chapter 12 as a transfer by gift made by the deemed owner. (b) Portion of trust to which section applies This section shall apply to— (1) the portion of a trust with respect to which the grantor is the deemed owner, and (2) the portion of the trust to which a person who is not the grantor is a deemed owner by reason of the rules of subpart E of part 1 of subchapter J of chapter 1, and such deemed owner engages in a sale, exchange, or comparable transaction with the trust that is disregarded for purposes of subtitle A. For purposes of paragraph (2), the portion of the trust described with respect to a transaction is the portion of the trust attributable to the property received by the trust in such transaction, including all retained income therefrom, appreciation thereon, and reinvestments thereof, net of the amount of consideration received by the deemed owner in such transaction. (c) Exceptions This section shall not apply to— (1) any trust that is includible in the gross estate of the deemed owner (without regard to subsection (a)(1)), and (2) any other type of trust that the Secretary determines by regulations or other guidance does not have as a significant purpose the avoidance of transfer taxes. (d) Deemed owner defined For purposes of this section, the term deemed owner means any person who is treated as the owner of a portion of a trust under subpart E of part 1 of subchapter J of chapter 1. (e) Reduction for taxable gifts to trust made by owner The amount to which subsection (a) applies shall be reduced by the value of any transfer by gift by the deemed owner to the trust previously taken into account by the deemed owner under chapter 12. (f) Liability for payment of tax Any tax imposed pursuant to subsection (a) shall be a liability of the trust. . (b) Clerical amendment The table of chapters for subtitle B is amended by adding at the end the