(a) In general Section 1923(g) of the Social Security Act (42 U.S.C. 1396r–4(g)) is amended—
(1) in paragraph (1)—
(A) in subparagraph (A)—
(i) in the matter preceding clause (i), by striking (other than a hospital described in paragraph (2)(B));
(ii) in clause (i), by inserting with respect to such hospital and year after described in subparagraph (B); and
(iii) in clause (ii)—
(I) in subclause (I), by striking and at the end;
(II) in subclause (II), by striking the period and inserting ; and; and
(III) by adding at the end the following new subclause:
(III) payments made under title XVIII or by an applicable plan (as defined in section 1862(b)(8)(F)) for such services.
; and
(B) in subparagraph (B)—
(i) in the matter preceding clause (i), by striking in this clause are and inserting in this subparagraph are, with respect to a hospital and a year,; and
(ii) by adding at the end the following new clause:
(iii) Individuals who are eligible for medical assistance under the State plan or under a waiver of such plan and for whom the State plan or waiver is a payor for such services after application of benefits under title XVIII or under an applicable plan (as defined in section 1862(b)(8)(F)), but only if the hospital has in the aggregate incurred costs exceeding payments under such State plan, waiver, title XVIII, or applicable plan for such services furnished to such individuals during such year.;
(2) by striking paragraph (2);
(3) by redesignating paragraph (3) as paragraph (2); and
(4) in paragraph (2), as so redesignated, by striking Notwithstanding paragraph (2) of this subsection (as in effect on October 1, 2021), paragraph (2) and inserting Paragraph (2).