Medicare will cover the cost of a hospital bed for at home use if it's deemed to be "medically necessary" and prescribed by a doctor.
For Medicare to pay for the hospital bed at home you have to get the hospital bed from a medical supply store that accepts Medicare.
The Medical Supplier must also be approved by Medicare and they will cover the cost of any medically needed durable medical supplies.
That's a good thing because hospital beds even for home are very expensive so you need either Medicare or other insurance to pay for it.