In rural towns across the U.S., hospitals are in crisis.

Since 2010, 121 rural hospitals have closed. The National Rural Health Association says more than one-third of all rural U.S. hospitals are at serious risk of shutting down.

The decision by some states not to expand Medicaid as part of the Affordable Care Act could be a big reason for many of the closures, according to the Georgetown University Health Policy Institute. Hospital consolidation, demographics and a drop in demand for inpatient services are other factors, according to one analyst.

But it's not just rural hospitals that are going out of business.

Several hospitals in urban areas including Phoenix and Chicago have shut down. One recent high-profile closure was Philadelphia's Hahnemann University Hospital, a 496-bed hospital considered by many to be a lifeline for the city's neediest.

It shut its doors in September as it struggled with monthly losses of $3 million to $5 million, according to news reports.

At the same time, larger U.S. hospital systems are thriving. Since the 1990s, a series of mergers and acquisitions has created mammoth hospital groups. Many of these hospital consortiums are turning huge profits every year by offering high-priced services like cardiac and orthopedic care to well-insured patients.

Every hospital has its own model for how it brings in cash.

Generally speaking, hospitals charge the highest rates to private commercial payers — people covered by private employer insurance — and receive lower payment rates for patients covered under government programs such as Medicare, for the disabled and people over age 65, and Medicaid which covers low-income Americans.

A hospital's location is a big indicator of the type of insurance a patient will have. Larger metropolitan areas tend to have more people who are covered under private employer health insurance, boosting the percentage of higher-paying patients. Rural areas with fewer large employers make for a lower number of privately insured patients.

"One of the greatest predictors of how much money a hospital makes is how wealthy the community is in which they are located," said Dr. Marty Makary, a surgical oncologist at John Hopkins Hospital. "Hospitals in wealthy communities have well-insured patients. Hospitals that are predominantly taking care of government-insured patients or poor patients tend to struggle."

One way hospitals have been able to drum up more cash: raising prices on private insurance plans. And one way hospital systems strengthen their ability to do that is by getting bigger.

Analysts say that's one of the factors driving all the mergers and consolidation across U.S. hospitals. By gaining market share, they can raise their prices.

Watch this video to find out more about how hospitals make money.

Watch more:

The decline of U.S. airports

Who makes Amazon shipping boxes

