This would have all been about Medicaid, not Medicare. Allow me to explain.
Medicare covers inpatient (hospital) and outpatient (doctor) care for senior citizens, but doesn’t cover ongoing residence in an assisted-living or skilled-nursing facility. Medicare will cover short-term residence in such a facility for rehabilitation (e.g., recovering from a surgery or a stroke), but that’s it; Medicare won’t cover the cost of living in a facility for an indefinite amount of time.
If you are in need of such 24/7 residential care, Medicaid (yes, the same program which provides health insurance for poor Americans) will cover the cost of a facility, but only if you are effectively already broke.
So, elderly people who are in need of that kind of care have to either (a) spend down their assets* until such time as they can no longer pay for residential care themselves, at which point Medicaid will pay for it, (b) look at other options (i.e., having a family member live with them and act as a caregiver, part-time professional caregiver care, etc.), or (c) have been fortunate enough, sufficiently foresightful, and wealthy enough to have purchased a “long-term care” insurance policy when one was younger.
Just giving all of your money to your family, to render yourself broke in order to qualify for Medicaid, doesn’t always work; Medicaid can look back something like 5 years to see if you did that.
And, yes, the nursing facilities which accept large numbers of Medicaid patients are often not the best ones.
Due to this, it’s entirely possible for the same person to be on both Medicare (which is paying for heir hospital and doctor bills) and Medicaid (which is paying for their nursing-home care) at the same time.
*- AIUI, they can’t force you to sell your house if your spouse doesn’t need that level of care, and is living in the home, but that’s one of the relatively few exceptions.