The way it /actually/ works in the U.S. is that the government directly funds a lot of basic research, and that research is done mostly by Universities. The researchers build prototypes and run experiments and write papers, and sometimes (often after a substantial time lag like 20 years) people in industry get around to reading these papers and incorporating those ideas into a real product. Or maybe the original researchers will graduate and form a company to productize their research.
Eventually someone like Elon Musk or Steve Jobs notices that there are some new products or processes or algorithms now available that weren't before, and they realize that that unblocks them from doing something that maybe people have wanted to do for a long time but they couldn't.
Sometimes companies might do some original research of their own. It does happen, but Universities have the advantage of a lot of really smart people willing to work for very little money, plus they have open communication with a diverse collection of peers and they're all trying to publish results not hide them away. So, they can generally get more done with less money.
If the government grants enable someone somewhere to make a billion dollars, that's considered money well spent because it grows the economy and they collect more tax revenue somewhere and maybe the Billionaires will even fund the re-election campaigns of their congressional representatives and everyone lives happily ever after. That's just how the system works.
(I think big pharmaceutical companies may be an exception in that I think they often are funded directly by the government to work on whatever the NIH thinks is important, such as cancer, diabetes, etc.. instead of what the drug companies would rather work on, like male pattern baldness. I don't know much about drug research so I can't really comment there.)