Russia's President Vladimir Putin (L) and his Chinese counterpart Xi Jinping talk before the opening ceremony of the fourth Conference on Interaction and Confidence Building Measures in Asia (CICA) summit in Shanghai on May 21, 2014. Reuters/Aly Song

Before he arrived in Shanghai on Tuesday, Russian President Vladimir Putin went to great lengths to extol his country’s relationship with China. Moscow's relationship with Beijing has rarely been better. In particular, Putin cited a proposed gas deal -- a 30-year deal worth $400 billion -- that would cement economic ties between the two giants.

“It’s about 98 percent ready,” he said.

The last 2 percent has proven elusive. The New York Times reported Tuesday that China and Russia have, surprisingly, failed to complete the deal.

The delay represents a disappointment for Moscow, which has lately conducted a public pivot toward China. Once completed, Russia will send 38 billion cubic meters of natural gas each year to China, a figure that may eventually rise to 61 billion. The deal makes sense for both sides. Russia, whose annexation of Crimea has strained relations with the West, will gain access to a vast new market. And China, beset by environmental problems caused in part by coal-burning plants, will obtain a cleaner source of energy.

So what got in the way of a deal? The price.

Since negotiations began 10 years ago, China has reportedly balked at paying what Russia charges Europe -- an amount thought to be more than $12 per cubic feet of gas. And since Russia still trades much of its gas to Europe, Moscow had little reason to compromise.

But in 2007, Beijing negotiated a deal with ex-Soviet states in Central Asia to fund a pipeline that now supplies around 80 percent of China’s natural gas imports each year. China also has begun to drill wells for shale gas exploration. And while Beijing has framed its assertiveness in the South China Sea as a principled defense of national sovereignty, energy considerations --- the waters surrounding many of the disputed territories are thought to contain oil and natural gas -- provide China with a clear economic incentive.

Russia’s calculus has also shifted. Moscow’s annexation of Crimea has ruptured its relations with the United States and Europe, while its economy -- which depends heavily on energy exports -- has slumped to 0.2 percent growth. Vladimir Putin sees China not just as a friend, then, but also as a savior. China knows this. And that gives Beijing leverage.

Both China and Russia have too much to gain from making the deal -- or, put another way, too much to lose for failing to do so -- that this delay is likely to turn into a permanent failure. But the underlying economics of the Sino-Russian relationship are a sober rejoinder to Putin’s triumphalist rhetoric.