The federal government is set to become the official owner of the Trans Mountain pipeline expansion project after failing to secure a new buyer by the July 22 deadline.

Ottawa made plans to purchase the pipeline after Kinder Morgan suspended construction of the expansion project, citing investor uncertainty stemming from ongoing opposition from the British Columbia government.

Ottawa has framed the plan to purchase the pipeline as financially sound and necessary to ensure a vital piece of energy infrastructure gets built, but questions have been raised about how much the government paid.

CBC News has obtained a copy of the purchase agreement with Kinder Morgan. Here's what you need to know:

The sale

The federal government announced in May its plan to buy the pipeline and its related infrastructure for $4.5 billion.

The agreement indicates that Kinder Morgan will receive a $2.7 billion capital gain on the sale.

Richard Masson, an expert in energy project development and an executive fellow at the University of Calgary School of Public Policy, took a look at Kinder Morgan's financial statements and compared it to the purchase agreement.

Although Kinder Morgan doesn't offer an exact number, Masson said the book value for the existing Trans Mountain pipeline is probably $600 million. That, added to the $1.2 billion valuation of the expansion project, brings the total book value to about $1.8 billion.

The government's payment, minus the total book value, is equal to Kinder Morgan's $2.7 billion capital gain.

The agreement stipulates Kinder Morgan expects to pay no less than $300 million in provincial and federal taxes on that capital gain. A recent regulatory filing with the U.S. Securities and Exchange Commission made by the company estimates that number is closer to $325 million.

Taking into account estimated taxes to be paid, the filing reports the "net price" of the pipeline to be $4.175 billion.

Good or bad deal?

Kinder Morgan's $2.7 billion capital gain doesn't necessarily mean that the government overpaid for the project, said Masson.

The low book value of the project reflects the fact that the value of the 65-year-old existing pipeline has depreciated for tax purposes for a very long time, said Masson.

The real value of the project comes from looking at its earning potential, he said. "Today, it's just as valuable as it ever was. Probably more valuable, because pipelines are in short supply and shippers really, really value getting their oil to the West Coast," said Masson.

Masson pointed to the performance of Kinder Morgan stocks at the time of the government's May announcement as a indicator of whether the federal government overpaid or underpaid for the controversial pipeline.

"If that stock had popped up 20 per cent then, you would have said, 'Well, the federal government obviously overpaid,'" he said. "Or if it had dropped about 20 per cent, you would have said, 'Well, they sold the assets for less than they were worth.'

"When the sale was announced, the value of that stock didn't move very much and that was an indication that those investors thought they got about a fair price for the assets."

What happens next?

Now that the deadline has passed for the government to secure a new buyer for the pipeline, Kinder Morgan is expected to take Ottawa's $4.5 billion offer to its shareholders for approval. That decision is expected to be made sometime in August or September.

The federal government insists it does not intend to be a long-term pipeline owner and will work with investors to transfer the project to a new owner when the time is right.

Masson said he thinks the government's ownership will be structured through a holding company with Ottawa as the main shareholder.

"That would allow the federal government to sell that whole company to some other buyer," said Masson. "Or if it turns out there's no other buyer, they could do an initial public offering and sell shares of that company to Canadians and just make it a publicly-traded company."

Masson said there are many examples of quasi-public-sector-owned companies that eventually were successfully privatized, including Petro Canada and the Alberta Energy Company.

Minister of Natural Resources Amarjeet Sohi told Power & Politics host Vassy Kapelos Monday that a number of companies have shown interest in the project and the government has had discussions with possible buyers, but a deal could not be reached because the political risk still remains.

"Once this project is underway and significantly de-risked, at that time, our government will look at a private sector proponent to take this project over," said Sohi.

Sohi pointed to the court challenge in B.C. and the general opposition in the province as factors generating uncertainty around the project.

In April, the B.C. government filed a reference case in the provincial Court of Appeal to test the province's authority to restrict and regulate the flow of oil through the pipeline. The federal government announced in May its intent to intervene in the case and defend what it describes as its "clear jurisdiction over interprovincial pipelines."

If B.C. is not satisfied with the outcome, the reference case could very well end up before the Supreme Court of Canada.

It remains unclear whether favourable resolutions in the courts will 'de-risk' the project enough to enable the eventual transfer of ownership from the government to the private sector.