And hospice care, usually delivered at home, is more available than ever before. Some 1.49 million Medicare beneficiaries received hospice care in 2017, a 4.5 percent increase from 2016, according to the National Hospice and Palliative Care Organization.

“There has been a kind of cultural shift that has romanticized dying at home and made it the only way to die,” said Carol Levine, an ethicist at the United Hospital Fund in New York.

At the same time, hospitals have long had financial incentives not to keep Medicare patients for long periods, noted Dr. Diane Meier, a professor of geriatrics and palliative medicine at the Icahn School of Medicine at Mount Sinai in New York.

Typically, Medicare pays hospitals per diagnosis per patient, not for the number of days a patient is in the hospital. Administrators “don’t want it to go on for a long time,” Dr. Meier said.

“We send very very sick, complicated patients home under the care of family members who are not trained professionals,” she added.

Many terminally ill patients wind up in the care of family members who may be wholly unprepared for the task.

“We are, perhaps appropriately, shifting the site of care to where patients and families say they want to be,” said Dr. Sean Morrison, chair of geriatrics and palliative medicine at the Icahn School of Medicine at Mount Sinai in New York.