A recent NYT column by Paul Krugman showcases exactly what is wrong with mainstream Keynesian economics. Krugman takes a JP Morgan note claiming that the iPhone 5 would boost economic growth, then concludes that the analysis proves that bigger government deficits are a good thing. As we’ll see, the only thing Krugman has proved is that he’s committed a basic error, in confusing actual economic growth with a mere statistical artifact.

Let’s first establish Krugman’s case. After telling his readers that analysts have suggested that the iPhone 5 might provide a “significant boost to the U.S. economy,” Krugman went on to argue:

Do you find this plausible? If so, I have news for you: you are, whether you know it or not, a Keynesian—and you have implicitly accepted the case that the government should spend more, not less, in a depressed economy.

A recent research note from JPMorgan argued that the new iPhone might add between a quarter- and a half-percentage point to G.D.P. growth in the last quarter of 2012.…

The crucial thing to understand here is that these likely short-run benefits from the new phone have almost nothing to do with how good it is—with how much it improves the quality of buyers’ lives or their productivity. Such effects will kick in only over the longer run. Instead, the reason JPMorgan believes that the iPhone 5 will boost the economy right away is simply that it will induce people to spend more.

And to believe that more spending will provide an economic boost, you have to believe—as you should—that demand, not supply, is what’s holding the economy back. We don’t have high unemployment because Americans don’t want to work, and we don’t have high unemployment because workers lack the right skills. Instead, willing and able workers can’t find jobs because employers can’t sell enough to justify hiring them. And the solution is to find some way to increase overall spending so that the nation can get back to work.

Krugman has things exactly backward here. I’ll first explain the correct way to think about the economy, and then we’ll diagnose specifically where Krugman goes wrong in his own analysis.

If we take a step back and think about it, it’s obvious that spending per se isn’t the source of economic benefits. It’s easy to spend. If that were really the only thing holding back economies in recession, then one wonders why humans still suffer from recessions, in so many countries and so repeatedly throughout history.

No, the real difficulty in economic life is production, in turning scarce resources into goods and services that the consumers value. This takes judgment on the part of entrepreneurs directing the process, and it takes hard work from their employees.

In addition to inventions as well as commercial innovations in business operations, a major source of economic growth is saving and investment. Even with a fixed amount of technological know-how, people can gradually increase their standard of living over the years if they defer immediate gratification. By saving out of present income—by living below their means—people “free up” scarce resources that no longer need to be used up to make burgers, iPods, and sports cars. Instead, these resources can be redirected into making tractors, drill presses, and microscopes for drug researchers. Rather than making consumer goods for present wants, the economy cranks out capital goods to cater to future wants. This is the physical analog of how the economy as a whole grows, just as an individual household’s bank balance grows with constant saving.

It should be clear that spending per se doesn’t drive economic growth. It’s true, in a modern economy money plays a crucial role in coordinating our activities, and in that sense spending is an integral part of the story. But from this truism it hardly follows that government spending is all we need right now to “boost the economy.” On the contrary, government spending simply siphons real resources away from the private sector and into politically-chosen channels, where they will be used in inefficient ways.

So if Krugman’s conclusion is wrong, where did he misstep in his argument? The problem is that he confused the thermometer with the fever. Under normal circumstances, a plausible way to measure aggregate economic production is to count up how many dollars people spend on the products. Following a certain method, this approach yields the conventional Gross Domestic Product (GDP) statistic. There are actually many conceptual problems with the technique, but to come up with a ballpark figure—to gauge how much more “stuff” the US produced in 2012 compared to 2011—it’s not terrible.

The crucial element in the analysis, however—the one thing that makes the GDP calculation at least remotely defensible—is that much of the spending is voluntary. So if the iPhone 5 really does bring in the sales figures that the JP Morgan note estimated, then this is prima facie evidence that the consumers derive benefits from the new devices. After all, that’s why they are spending their money buying the thing.

In contrast, if the government spends the same number of dollars, there is no reason to suppose that genuine “economic output” has gone up by the same amount. In the classic example, suppose the government spends the money paying workers to dig ditches and then fill them back up. Clearly, in this scenario there would be nothing to show for the government expenditure.

In fact, the economy as a whole would be poorer, to the extent that the workers would have preferred leisure to digging ditches. If the workers voluntarily accept the ditch-digging job, then the goods they buy with their paychecks must have been redistributed from others, who are now poorer because of the taxes or deficits used to pay the government employees. After all, digging ditches doesn’t create more goods to go around.

Paul Krugman and other Keynesians can come up with bizarre theories explaining why paying workers to dig ditches actually can make society richer. But Krugman offered no such story in his iPhone analysis. Instead, he committed the basic blunder of mistaking a rise in the GDP statistic with a genuine increase in human well-being. Under normal circumstances, the two are related, and this is why we might carelessly view rising GDP as “good for the economy.” But to artificially goose the figure through government spending is to confuse a mere symptom for the real thing.

Robert P. Murphy is author of The Politically Incorrect Guide to Capitalism. His blog is Free Advice. Follow him on Twitter.