While the United States Postal Service continues to lose money, the service has been thrown a lifeline by Amazon.com (AMZN -1.33%), which has partnered with the struggling government entity. The two have been working for over a year offering Sunday delivery in select markets and now they are beginning to roll out grocery delivery in parts of the country.

The relationship with Amazon has been a rare bright spot for the USPS, which has struggled with falling first-class mail volume.

A mail carrier delivers packages. Source: USPS.

How bad is the USPS doing?
Losses are mounting for the USPS and the agency faces huge retirement payouts it's unlikely to be able to meet. In the quarter ended June 30, the USPS lost $2 billion, compared to a  loss of $740 million for the same period last year. That continues a pattern where the agency has lost money in 21 of the last 23 quarters.

That's bad, but the actual problem is worse than that as the only two quarters it made money occurred when Congress allowed it to reschedule mandated prefunding for its employee retirement accounts. It's those benefits which could ultimately bring the USPS into insolvency.

USPS Chief Financial Officer Joseph Corbett said in a press release last month that the USPS will be unable to make the required $5.7 billion retiree health benefit prefunding payment that is due to the U.S. Treasury by Sept. 30. He also highlighted how spending that had been put off will eventually be needed and called for congressional action:

Due to continued losses and low levels of liquidity, we've been extremely conservative with our capital, spending only what is deemed essential to maintain existing infrastructure. To continue to provide world-class service and remain competitive, we must invest up to $10 billion to replace our aging vehicle fleet, purchase additional package sorting equipment, and make necessary upgrades to our infrastructure.

Amidst all the bleak news, there have been some improvements, partially due to price increases and partly due to an increased volume of package deliveries (some of which is due to Amazon). In the most recently reported quarter, total operating revenue was $16.5 billion, a 2% ($327 million) improvement over the same period last year.

Shipping and package revenue grew by 6.6% while standard mail revenue was up 5.1%, driven by a small gain in volume and a price increase which went into effect in January. First-class mail volume dropped 1.4%, but revenue for that segment rose by 3.2% due to the higher prices,

How is Amazon helping?
Having an enormous, paying customer at a time when regular people are using your services less often can only help. Neither Amazon nor the USPS has reported specifically on the success of the Sunday delivery program but its continued expansion suggests it's working. Given how cautious the USPS has become with its dwindling cash, it can be assumed that the arrangement benefits the bottom line.

Grocery delivery is a similar deal to Sunday delivery where it will make use of USPS resources and infrastructure at times where they are under-utilized. In the pilot program which is being tested in San Francisco, USPS trucks drop off Amazon's grocery orders in insulated tote bags between 3 a.m. and 7 a.m., according to The Wall Street Journal.

This lets the post office put some assets to work making money and perhaps allows it to get more work out of its early morning staff. For Amazon, if it works, the relationship lets the company expand its fledgling grocery service much faster than it could build its own fleet of trucks.

If the arrangement succeeds, it's not hard to see how the two entities could grow their working relationship. That might involve using USPS trucks for same or next-day delivery of the items Amazon ships from its warehouses located around the country. It could also involve the shift of some business from the online retailer's longtime shipping partner United Parcel Service (UPS -1.98%) to the USPS.

Can Amazon save the USPS?
Amazon is a great customer for the post office and it can be part of its turnaround, but it cannot solve the agency's retirement benefit issues. If Congress takes action to revamp those obligations, Amazon could be a big part of whatever emerges from the ruin that is currently the USPS.

No one partnership can reverse the fact that technology has made many forms of traditional mail irrelevant, which has lowered volume for the post office. That said, the Postal Service still delivers mail all across the country six days a week to pretty much every residence and business. That's a service Amazon can ultimately piggyback on, allowing it to fully take advantage of its network of warehouses without launching its own trucking service.

If USPS infrastructure and Amazon infrastructure can be made to work efficiently together, then the Postal Service can solve a problem for the online retailer which should allow for faster, more efficient delivery, to more places, at a lower cost.