President Barack Obama, soon after releasing his federal budget proposal for fiscal year 2012, flew to California to dine with some of the biggest names from America’s high-tech business sector, including Steve Jobs of Apple, Facebook’s Mark Zuckerberg, Google’s Eric Schmidt and Yahoo’s Carol Bartz.

The president visited Silicon Valley to promote his "competitiveness agenda," backed by billions of dollars in new federal spending, which, according to the White House, is meant to finance investments "in research and development and to expand incentives for companies to grow and hire."

Obama apparently did not see the irony in extolling the virtues of more federal money for science and technology before a group of people who, by and large, had founded and grown their businesses into stunning success stories without government handouts.

If Congress approves billions of dollars in new federal spending for corporate R&D, don’t be surprised if Silicon Valley’s executives lobby for a share of the loot. But they should be careful about what they ask for.

While public "investments" in technological innovation sound like a good idea, the danger is that the funds will be directed toward politically popular projects rather than those with the highest economic value. Remember Jimmy Carter’s quest for a new synthetic fuel or Bill Clinton’s dream of getting Detroit to produce a car that would go 100 miles on a gallon of gas? Untold federal treasure was wasted chasing those wills of the wisp. The notion that technological innovation requires government subsidies is not modern.

During and after the Civil War, for example, the U.S. government provided the Union Pacific and Central Pacific railroads incentives to build the first transcontinental railway link. The two companies received grants of 20 square miles of land for each mile of track they laid and taxpayer-financed loans of up to $48,000 per track mile, depending on the terrain.

Those who think that that engineering feat could not have borne fruit without federal subvention must never have heard of the Great Northern Railway. That line (now part of the Burlington Northern system) connected St. Paul, Minn., to Seattle—a distance of 1,700 miles over the Northern Rockies. It was completed in January 1893.

Built entirely with private funds, the Great Northern was the work of James J. Hill, not Uncle Sam. There were no federal land grants; no loans.

Hill and his colleagues began by purchasing the assets of the bankrupt St. Paul and Pacific Railroad, whose owners, despite government subsidies, had laid only 10 miles of unconnected track. The new team completed the original line, put it on a sound financial footing, and then extended it into North Dakota, ensuring adequate traffic by promoting the development of agriculture along the route. They even gave livestock and feed away to help get farmers and ranchers get started.

The Great Northern also built branch lines that served farms off the main track. Congress, in contrast, prohibited the subsidized railroads from doing so, fearing that the additional cost would jeopardize repayment of their federal loans.

There are two lessons here. The first should be obvious: bureaucrats have no incentive to invest in the most commercially promising ventures. Indeed, federal subsidies prompt businesses to take risks they would not take otherwise. The Union Pacific and Central Pacific went bankrupt eventually.

The second is that if Washington funds Silicon Valley’s R&D efforts, politicians and bureaucrats, not the techies, will be calling the shots.

Had government been looking over Steve Jobs’ shoulders, I don’t think the iPhone or iPad would be on the market today.