Source: Wikimedia Commons.

At times, Mr. Market can get a little overexcited about certain events. When Rite Aid (RAD -37.50%) and McKesson (MCK 0.60%) announced plans on Feb. 18 to extend their partnership through March 31, 2019, shares of Rite Aid soared nearly 6%, briefly touching a new 52-week high before settling at $6.27. Did the market respond a little too favorably to the news and, in turn, push shares of Rite Aid into overvalued territory, or is this extended agreement a sign of much better times to come for the business?

The importance of Rite Aid's agreement with McKesson
Oftentimes, when a company signs an agreement with another party, it makes sure that it doesn't have too much exposure should the deal fall through in the future. In other cases, a company decides to rely entirely on its partnership, with the expectation that the deal will create greater efficiencies. Rite Aid falls in the latter category.

Since April 10, 1998, Rite Aid has contracted with McKesson to supply the bulk of its prescription drugs. In fact, during 2013, the company ordered nearly 89% of its dollar-volume worth of prescriptions from the wholesaler, including all of its branded pharmaceutical products. As of Rite Aid's most recent annual report, its agreement with McKesson was due to expire March 31, 2016, but both companies have recently agreed to extend the agreement through March 31, 2019.

McKesson isn't the only sweet deal Rite Aid has...
In an effort to leverage its business, Rite Aid has reached out to other industry players to find deals that can create shareholder value. Probably its single most important -- with the possible exception of its deal with McKesson -- is between it and GNC Holdings (GNC).

In 1999, Rite Aid and GNC partnered to build GNC store-within-a-store setups in Rite Aid locations. Since the implementation of their plan, Rite Aid has added around 2,200 GNC stores (accounting for more than 26% of all GNC locations) under its roof. Unfortunately, Rite Aid provides too little information on its operations for us to determine the profitability of its deal with GNC, but we can know how well GNC is profiting from it.

On a per-store basis, GNC has brought in around $28,000 as a result of its partnership. This is significantly lower than the roughly $368,000 that GNC brings in for each of its stand-alone stores, but the 40.3% operating margin the segment earned in 2012 illustrates its importance to the company's profitability.

Rite Aid's strategic partnerships might be the only way to save it
Over the past few years, Rite Aid has undergone some difficult times. Reeling from the U.S. financial crisis, the company has seen its sales stagnate and its profitability fall off a cliff. For instance, in 2009, the company reported revenue of $26.3 billion and a net loss of $2.9 billion.

With the goal of salvaging the business, management closed down locations and has refocused their efforts on improving the company's profitability. Although revenue has fallen 3% since then, its net loss has turned into a net gain of $118.1 million, effectively reverting the company's net profit margin from negative 11.1% to positive 0.5%.

This stands in stark contrast to rivals like CVS Caremark (CVS -0.56%) and Walgreen (WBA 1.36%). Over the past five years, both companies have been intent on improving their sales figures and profitability.

Source: MSN Money.

Walgreen, for instance, has increased its revenue 14%, from $63.3 billion in 2009 to $72.2 billion in 2013. Because of rising sales, combined with lower costs in relation to sales, Walgreen has experienced a 22% jump in its net income, from $2 billion to $2.5 billion. This has allowed the company to improve its net profit margin slightly, from 3.2% to 3.4%.

CVS' situation has been even better. Over the past five years, CVS has earned itself a 29% jump in revenue. Although net income at the world's largest drugstore chain rose only 4.5%, from $3.7 billion in 2009 to $3.9 billion in 2012, management reported that the company's bottom line leapt 19% to $4.6 billion by 2013, but its net profit margin declined from 3.8% to 3.6%. Just as with Walgreen, CVS saw its rise in profitability come from an increase in its revenue, though this was partially offset by a rise in its cost structure.

Foolish takeaway
Right now, Rite Aid is struggling to hold on against larger rivals like CVS and Walgreen. Seeing as both businesses are far larger and have greater resources than it, the company is attempting to make up for its shortcomings by striking up lucrative contracts that can help it improve its bottom line as soon as possible. Once the company demonstrates to shareholders that it can hold its own and, eventually, grow, it will likely make an attractive prospect that could generate a great deal of long-term value.

However, there is one thing to consider. As part of its deal with McKesson, Rite Aid is currently receiving what it believes to be improved efficiencies as opposed to finding new ways to create value. Recently, the company's focus on improving its operations appears to be paying off, but it's important to keep in mind that the company's revised deal likely won't go so far toward creating additional value as it will toward preserving value that's already there. For this reason alone, Foolish investors might want to ask themselves if the business's new high is a good time to sell, given that the deal shouldn't make Rite Aid much more valuable than it already was.