SOUTH PORTLAND — A broken water main last April flooded the road across the street from the state’s biggest shopping mall, shutting down two restaurants and leaving two hotels without water.

Water main breaks large and small happen about 90 times a year in the Portland Water District, underscoring the aging underground networks of pipes in a nation where people take for granted that there’s always clean, cheap, readily available water on tap.

The U.S. Environmental Protection Agency projects it will cost $384 billion over 20 years just to maintain the nation’s existing drinking water infrastructure. Replacing pipes, treatment plants and other infrastructure, as well as expanding drinking water systems to handle population growth, could cost as much as $1 trillion.

In Maine, it will cost more than $737 million to maintain the transmission and distribution system alone, the EPA said. The figure tops $1 billion when needed improvements are included.

Despite the need, the largest federal aid program for drinking water improvements, the Drinking Water State Revolving Fund, has more than $1 billion sitting unspent in government accounts, according to a review by The Associated Press. Roughly 10 to 11 percent of federal funding remains unspent in Maine, said Roger Crouse, director of the Maine Drinking Water Program. The state has received $185.6 million from the fund since 1996.

One of the biggest concerns about drinking water in Maine is the safety of wells, where half the state’s homes get their tap water. But public systems have their own issues.

The state has replaced or upgraded public treatment facilities in recent years, but the aging system of underground pipes remains a problem. The state is failing to meet the American Water Works Association’s recommendation of replacing 1 percent of pipe each year, Crouse said.

The aging infrastructure is evident in Maine’s biggest metropolitan area, where the Portland Water District has some water mains dating nearly to the Civil War.

Portland’s busy Commercial Street, which includes the working waterfront, excursion boats and shops and restaurants, is served by a cast iron water main that was installed in 1883. Other pipes date back even further, to 1869 and 1870.

With so many old pipes, water main breaks are inevitable. Last year, 98 water mains burst. There were 21 alone in February, when temperatures plummeted.

In South Portland, the water main broke near the Maine Mall on Patriot’s Day weekend, delaying the response of workers. One hotel had to move all of its guests to another property elsewhere in the region.

At least 20 workers were idled at one of two restaurants affected by the break.

“It shut the restaurant down for the day. It was huge,” said Joe Rashid from Chili’s, which lost a day of revenue.

The Portland Water District adopted a comprehensive plan for replacing water mains in 1985, and annual spending has grown from $2.5 million in 2011 to today’s level of $6.5 million, said Michelle Clements, spokeswoman for the water district. Each year, she said, the district replaces 5 to 6 miles out of 1,000 miles of water mains.

Most improvements rely on some sort of grants, and the state matches grants from the federal Drinking Water State Revolving Fund through money provided from the state liquor contract that was originally set up to pay back hospital debt, Crouse said.

Without such investments, industry groups warn of a future with more infrastructure failures that will disrupt service, transportation and commerce.

“We’ve ratcheted up our investment in replacing old water mains and leaky water mains, so that we can maintain water quality and make sure disruptions are kept low,” Clements said.