transaction, or similar financing transaction. (ii) Insurance contracts, annuities, and endowments The term derivative shall not include any insurance, annuity, or endowment contract issued by an insurance company to which subchapter L applies (or issued by any foreign corporation to which such subchapter would apply if such foreign corporation were a domestic corporation). (3) Qualified board or exchange The term qualified board or exchange has the meaning given such term by section 1256(g)(7). (f) By whom paid (1) In general The tax imposed by this section shall be paid by— (A) in the case of a transaction which occurs on, or is subject to the rules of, a qualified board or exchange located in the United States, such qualified board or exchange, and (B) in the case of a purchase not described in subparagraph (A) which is executed by a broker (as defined in section 6045(c)(1)) which is a United States person, such broker. (2) Special rules for direct, etc., transactions In the case of any transaction to which paragraph (1) does not apply, the tax imposed by this section shall be paid by— (A) in the case of a transaction described in subsection (d)(1)(A)— (i) the purchaser if the purchaser is a United States person, and (ii) the seller if the purchaser is not a United States person, and (B) in the case of a transaction described in subsection (d)(1)(B)— (i) the payor if the payor is a United States person, and (ii) the payee if the payor is not a United States person. (g) Treatment of exchanges and payments with respect to derivatives For purposes of this section— (1) Treatment of exchanges (A) In general An exchange shall be treated as the sale of the property transferred and a purchase of the property received by each party to the exchange. (B) Certain deemed exchanges In the case of a distribution treated as an exchange for stock under section 302 or 331, the corporation making such distribution shall be treated as having purchased such stock for purposes of this section. (2) Payments with respect to