medical expenses For purposes of this section— (A) In general The term qualified medical expenses means, with respect to an account beneficiary, amounts paid by such beneficiary for medical care (as defined in section 213(d) as in effect on the day before the date of the enactment of the Patient Freedom Act of 2017 ) for such individual, the spouse of such individual, and any dependent (as defined in section 152, determined without regard to subsections (b)(1), (b)(2), and (d)(1)(B) thereof) of such individual, but only to the extent such amounts are not compensated for by insurance or otherwise. (B) Limitation on health insurance purchased from account Such term shall not include any payment for health benefits coverage that is not creditable coverage (within the meaning of title XXVII of the Public Health Service Act). (C) Exceptions Subparagraph (B) shall not apply to any expense for coverage under— (i) a health plan during any period of continuation coverage required under any Federal law, (ii) a qualified long-term care insurance contract (as defined in section 7702B(b)), (iii) a health plan during a period in which the individual is receiving unemployment compensation under any Federal or State law, or (iv) in the case of an account beneficiary who has attained the age specified in section 1811 of the Social Security Act, any health insurance other than a medicare supplemental policy (as defined in section 1882 of the Social Security Act). (3) Account beneficiary The term account beneficiary means the individual on whose behalf the Roth HSA was established. (4) Certain rules to apply Rules similar to the following rules shall apply for purposes of this section: (A) Section 219(f)(3) (relating to time when contributions deemed made). (B) Section 219(f)(5) (relating to employer payments). (C) Section 408(g) (relating to community property laws). (D) Section 408(h) (relating to custodial accounts). (5) Account terminations Rules similar to the rules of paragraphs (2) and (4) of section 408(e) shall apply to