But how can the Ricardian trap be avoided, i.e. an outcome where the government stimulus fails to boost aggregate demand because economic agents expect future tax increases to pay for larger deficits and thereby increase savings? To avoid the Ricardian trap, it is important to go beyond conventional Keynesian stimulus of “digging a hole and paving a hole” by investing in projects which increase future productivity."
No one can disagree with the statement that if the government can choose between different spending projects, they should select the one with the highest return (in terms of productivity and income). But we need to understand that the advise for the government to invest in productive investment applies at all times (good and bad). What is different when there is spare capacity is that "pure demand" policies can bring the economy closer to potential in a shorter period of time. By doing so they will be increasing the overall output and income of the country. And this additional income is the source of potential increases in private spending and tax revenues. This is the intuition behind the Keynesian recipe for times of high unemployment, which is consistent with the concerns of Justin Yifu Lin.
Let me add one other important element to this critique of this supposed critique of Keynesian policies from the Chief Economist of the World Bank. Ricardian Equivalence might hold that a permanent increase in government purchases would lead to an increase in permanent taxes, which would cause private consumption to fall by an equal amount. But even if a temporary increase in government investment were squandered say on building new pyramids or another damn baseball park for a team like the Yankees (with all due apologies to my neighbors who may be Yankee fans), standard lifecycle models of consumptions (e.g., Ricardian Equivalence) do not predict a fully offsetting reduction in consumption.