; and (II) by striking or at the end; and (ii) by adding at the end the following: (J) For any taxable year beginning in any calendar year after 2017, an amount equal to— (i) in the case of an individual with wages (as determined under section 209(a) without regard to paragraph (1) of such section) less than $300,000 and more than the contribution and benefit base (as determined under section 230 of the Social Security Act) which is effective for the calendar year in which such taxable year begins, the lesser of— (I) the excess of $300,000 over the wages (as so determined) paid to such individual during such taxable year, or (II) the net earnings from self-employment for the taxable year, and (ii) in the case of a taxpayer with wages (as so determined) less than or equal to such contribution and benefit base and for whom the sum, for the taxable year, of net earnings from self-employment and wages (as so determined) paid to such individual is greater than such contribution and benefit base, the lesser of— (I) the excess of such sum over such contribution and benefit base, or (II) the excess of $300,000 over such contribution and benefit base. . (B) Phaseout Section 211(b) of the Social Security Act ( 42 U.S.C. 411(b) ) is amended by adding at the end the following: Paragraph (1) shall apply only to taxable years beginning in calendar years for which the contribution and benefit base (as determined under section 230) is less than $300,000. . (3) Effective date The amendments made by this subsection shall apply to net earnings from self-employment derived, and remuneration paid, in calendar years after 2017. 3. Inclusion of earnings over $300,000 in social security benefit formula (a) Inclusion of earnings over $300,000 in determination of primary insurance amounts Section 215(a)(1)(A) of the Social Security Act ( 42 U.S.C. 415(a)(1)(A) ) is amended— (1) in clause (ii), by striking and at the end; (2) in clause (iii), by inserting and at the end