If the time for deficit spending is when the economy is in recession, then the Harper government seems to have got it backwards.

According to the latest figures, during the years when Canada was reaping the staggering benefits of an oil and commodities boom, the government piled on more debt. We now know that it was only after the economy began shrinking and needed help that the government squeezed out a surplus.

The current government may not be enamoured of a Keynesian analysis, but whether intentionally or by an error in planning, they have done the exact opposite.

Older than Keynes

In its best formulation, the intent of Keynesian stimulus is to smooth out the sharp rises and falls in an economy. The government should run surpluses when the economy is booming [and] spend that surplus when the private sector economy is shrinking.

In its broadest form, the theory is hardly a recent invention. In the Old Testament, Joseph gets a tip-off about a coming famine and during "the good years," he begins gathering food in the storehouses.

"Let the food become as a reserve for the land for the seven years of famine," says the biblical book of Genesis. "And the famine was over all the face of the Earth: and Joseph opened all the storehouses."

Perhaps the government had a cabinet meeting that Sunday. For whatever reason, they seem to have opened the storehouses during the good years and done their gathering during the famine.

The savings that went into the government's surplus were accumulated from spring of last year, just before oil prices began their slide from about $100 to about $50 US a barrel. The period of savings covered in yesterday's budget document continued right through to the first quarter of this year, when a commodities crash caused the Canadian economy to shrink by a little less than one per cent.

And it didn't end there. Harper has also boasted that he had created a surplus during the April-to-June period, when, as we later found out, Canada had entered a technical recession.

Imaginary line

To some extent, surpluses are like recessions. They are an imaginary line in economic bookkeeping. When you are close to the line, it really doesn't matter in practical terms whether you are little above or a little below.

The Liberals and others have said the surplus was "phoney" and that Harper was actually running a deficit. It is true that the government had a political motivation to massage the numbers, including the fact that some of their election promises were contingent upon getting into surplus.

But if we take the numbers at face value, there is no question that the government was fanning the flames of the resource economy when it was burning hot, and taking away fuel when it was cooling.

The modern equivalent of storehouses full of grain is the tax system.

One of the ways the government fanned the flames was with tax breaks. The modern way to create a national war chest is to hold taxes slightly higher than what the government is spending. The accumulating pool of cash can be held in reserve for the bad times.

There is no reserve. So where did the money go instead?

Against the warnings of economists from many different parts of the political spectrum, the government started in 2006 to cut the Goods and Services Tax or sales tax, which immediately increased the deficit. There were also personal income tax cuts that benefited the employed and better off.

Disappearing taxes

There are dire predictions the commodities bust could last for years. A new-economy boom remains a phantom. (The Associated Press) By now, those of us who got those tax breaks have either spent all that money or used it to bid up investments like stocks and houses. If stocks and houses start to fall, you tell me where the money has gone.

Cuts in corporate taxes, especially to companies in the resource sector, have also disappeared. Some of the money companies saved was re-invested, but for big resource and industrial firms owned by foreigners, a lot of those tax cuts have left the country as profits and dividends. It could be argued that the money that was invested is disappearing too, as resource firms scale back.

It is good to be optimistic, but it is not yet clear that the Canadian economy is out of the woods. There are dire predictions the commodities bust could last for years. A new-economy boom remains a phantom.

It seems clear to me that the Harper government's greatest sin was one of optimism. Enthused by a private sector-led resource boom, they were more shocked than anyone that their spend-now-and-cut-later plan had gone sour. And by then they were locked into their optimism-laced promises.

But if the hard times continue, no matter who eventually takes the reins of government, the cupboard will be bare. There are no significant government savings and raising taxes will just take money out of one part of the economy and move it around. At that point, the only way to return to the stimulus of deficits will be to borrow from the future.

Follow Don on Twitter @don_pittis

​More analysis by Don Pittis