over-the-counter medicine or drug. . (c) Health flexible spending arrangements and health reimbursement arrangements Subsection (f) of section 106 is amended to read as follows: (f) Reimbursements for all medicines and drugs For purposes of this section and section 105, reimbursement for expenses incurred for any prescription or over-the-counter medicine or drug shall be treated as a reimbursement for medical expenses. . (d) Effective dates (1) Distributions from savings accounts The amendments made by subsections (a) and (b) shall apply to amounts paid in taxable years beginning after December 31, 2017. (2) Reimbursements The amendment made by subsection (c) shall apply to expenses incurred in plan years beginning after December 31, 2017. 302. Purchase of health insurance from HSA account (a) In general Paragraph (2) of section 223(d), as amended by section 301, is amended— (1) by striking 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 in subparagraph (A) and inserting any dependent (as defined in section 152, determined without regard to subsections (b)(1), (b)(2), and (d)(1)(B) thereof) of such individual, and any child (as defined in section 152(f)(1)) of such individual who has not attained the age of 27 before the end of such individual's taxable year , (2) by striking subparagraph (B) and inserting the following: (B) Health insurance may not be purchased from account Except as provided in subparagraph (C), subparagraph (A) shall not apply to any payment for insurance. , and (3) by striking or at the end of subparagraph (C)(iii) and by striking subparagraph (C)(iv) and inserting the following: (iv) an HSA-qualified health plan, or (v) any health insurance under title XVIII of the Social Security Act, other than a Medicare supplemental policy (as defined in section 1882 of such Act). . (b) Effective date The amendments made by this section shall apply with respect to insurance purchased after the date of the