The federal budget is a funny thing -- and to paraphrase Gilligan's Island , I don't mean funny-funny, but funny strange, and verging on incomprehensible. Take the science budget (please) ...

US Government Discretionary General Science, Space, and Technology Spending Chart

US Government Discretionary General Science, Space, and Technology Spending data by YCharts.

Just one glance at the above chart will tell you that we spend a lot of money on "science." According to OMB figures, the U.S. will spend just over $30.5 billion on science-related work in 2016, and grow that number nearly 10% to nearly $33.5 billion over the next five years.

But it's a broad definition, this "general science, space, and technology." Depending on whom you ask, monies spent on this category might include anything from the $18.5 billion that the government provides NASA every year, to $5.3 billion in funding for the Department of Energy's "Office of Science," to the $200 million spent by the Department of Education on "Math and Science Partnerships " -- and a whole lot in between.

Expand the definition just a smidge, and the Congressional Research Service  will tell you that in 2016 alone, we're expecting to pay closer to $95.8 billion through a combination of monies spent on NASA, general science and basic research, "farm income stabilization," and "other." We'll also sort-of-spend another $35.5 billion through a combination of taxes-not-received from companies claiming "research credits" and other science-related tax breaks.

That's more than four times the amount we spend on "science" according to OMB.

Who gets the loot?

Any way you look at it, these are big numbers the government is spending on science -- and they're going up. There ought to be a way for investors to profit from all this spending, don't you think?

Actually, there is. Not long ago, I reviewed a report market researcher BGA-Aeroweb, running down the top 10 private companies receiving government funds in 2015. You probably won't be surprised to learn that a lot of them do work directly related to science. In fact, the top two companies on that list, Lockheed Martin (LMT 1.71%) and Boeing (BA -0.24%), also feature prominently on another list I prepared recently, laying out the top 10 NASA contractors.

Now NASA, as we've seen up above in the OMB figures, is easily the single biggest recipient of government "general science, space, and technology" funds. As such, it's the single biggest conduit for such funds to publicly traded companies that we can invest in -- such as Boeing and Lockheed.

And Boeing and Lockheed Martin do a lot of work in fields other than just space exploration. For example, Boeing is doing research into hypersonic flight that has applications both to NASA's space program (creating new means for getting satellites into space) and to Boeing's own business of building commercial airplanes as well. For its part, Lockheed Martin builds NASA's Orion space capsule, yes. But Lockheed is also conducting basic research into cold fusion reactors -- research with the potential to transform the world, solving both the energy and the global warming crises in one fell swoop.

Incidentally, both these initiatives promise to produce broad and deep new revenue streams for the companies in their private businesses. In the meantime, though, they help to ensure that when the government spends money on "general science, space, and technology" projects, both Lockheed and Boeing will get their share of the pie.