On Friday morning, President Donald Trump decided to take on the U.S. Postal Service.

"Why is the United States Post Office, which is losing many billions of dollars a year, while charging Amazon and others so little to deliver their packages, making Amazon richer and the Post Office dumber and poorer?" he wrote on Twitter. "Should be charging MUCH MORE!"

The tweet gave Trump the opportunity to slam Amazon (AMZN), which has been a frequent target of his ire. But with the tweet, the president also waded into a long-running, Byzantine debate over how much the Postal Service should charge for its services.

In short: Trump is likely right that the Postal Service charges less than it really costs to deliver packages, and Amazon is one of its biggest customers. But that's not the root of the agency's fiscal problems.

Why is the United States Post Office, which is losing many billions of dollars a year, while charging Amazon and others so little to deliver their packages, making Amazon richer and the Post Office dumber and poorer? Should be charging MUCH MORE! — Donald J. Trump (@realDonaldTrump) December 29, 2017

First of all, the U.S. Postal Service is unlike any other business. It has a government sanctioned monopoly over first-class mail, which it is obligated to send to every corner of the United States for the cost of a stamp.

At the same time, it competes with FedEx and UPS to deliver parcels — but its rates are approved by a board appointed by the president, and almost every aspect of its operations are governed by Congress.

With email replacing snail mail, that first-class mail business has declined dramatically — it's down by 40% since peaking in 2000. Meanwhile, the parcel delivery business has exploded. But the Postal Service hasn't been able to compensate for collapsing mail volumes due to a 2006 law that capped price increases at the rate of inflation and also limited the proportion of its budget that could be devoted to its parcel business.

Related: UPS unveils Saturday delivery -- and 6,000 new jobs

Still, the Postal Service might be able to eke out a profit if it weren't for another way in which Congress has tied its hands: It requires the agency to pre-fund its retiree health benefits and count them as operating expenses. In fiscal 2016, the Postal Service brought in $69.4 billion in revenue, was liable for $5.8 billion in retiree health benefits and reported a $5.6 billion net loss.

It makes sense to look to package delivery as a way to turn those fortunes around.

An analyst note by Citigroup from April found that prices would have to go up by $1.41 per package in 2018 — or about 40% — to reflect the true cost of delivery. (Those calculations are based on an analysis by UPS (UPS), which along with FedEx (FDX) stands to gain enormously if the Postal Service raises its prices, so they should be taken with a grain of salt.)

That could be a big hit to Amazon, which is one of the largest users of that parcel delivery service. The Citigroup analysts estimate that would add $2.6 billion to its current shipping costs, an increase of about 28%. Amazon did not respond to a request for comment.

Perversely, that could end up benefiting the Seattle retail behemoth. According to Citigroup, Amazon already gets bulk pricing discounts because of its enormous volume, and is rapidly building out its own distribution network, which will give it more delivery options down the line. For that reason, the Citigroup analysts predict that a Postal Service price hike would hurt other retailers more than Amazon.

"Such a scenario should further increase Amazon's cost advantage to consumers," Citi's note reads. "While the higher shipping costs would likely hurt Amazon's margin in the short-term, increased purchase frequency and customer density should benefit margins over time."

Related: Trump budget would hit tens of thousands of federal workers

So, is any of this going to happen?

In the short term, partially. The Postal Regulatory Commission just completed a year-long review of rate-setting policy, and recommended that the Postmaster General be given the authority to raise rates a couple percentage points above inflation, which could bring the agency closer to breakeven.

Meanwhile, the Postmaster General has urged passage of legislation pending in Congress that would give the agency more control over its operations and relieve it of the burden of pre-funding health benefits. Looking forward, a coalition of unions and public interest nonprofits have advocated for allowing the Postal Service to provide other services, such as banking, through its vast network of post offices.

Trump has sway over the Postal Service. He's made three board nominations, who are currently awaiting Senate action. By law, it's supposed to have nine appointed members, and currently it has none.

Correction: An earlier version of this article incorrectly stated the number of nominations the president has made so far to the Postal Service board.