It sounds like the facility is badly overstating the case -- Medicare benefits will not stop. Your grandmother has every right to leave the facility if she wants to, and your mother has a legal right to check her out of the facility and take her home (assuming she has a properly executed power of attorney from your grandmother). The real question is, what happens next?
The facility people might be trying to say that for your grandmother to receive Medicare coverage for any medical care, home health care, or medical equipment (like a hospital bed) and supplies, while she's living at home, a doctor must determine that the care or equipment is "medically necessary" and must give a prescription for it. Your grandmother's doctor might not agree with the decision to take your grandmother home, but the doctor can't stop providing proper, medically necessary care for your grandmother just because the doctor thinks your grandmother would be better off in the facility. If your grandmother is determined to stay at home, the doctor should prescribe all appropriate medical care and equipment to care for her there. And if the doctor properly prescribes something for your grandmother which Medicare normally covers, Medicare won't refuse coverage just because she could be in a nursing facility instead.
The key thing in this situation is to convince your grandmother's doctor of how important it is for your grandmother to be at home, and then to get his cooperation in getting the most Medicare coverage possible for her care there. Even with the doctor cooperating, though, Medicare coverage for home health care is limited both in terms of how often a home health care nurse or aide will visit, and how long the visits will continue. Because of these rules, your mother and other family members may have to do a tremendous amount of caregiving for your grandmother on your own (which may be why the doctor thinks a facility is a better place).