This is another gross oversimplification at best, and I have yet to hear anyone who has spent significant amounts of time in either public or private sector R&D make such a claim. Real life, and product development in particular, is not so easily reduced to catchy political slogans.
You can make some arguments about things like iPhones but that device depended on a huge state funded or regulated infrastructure to be useful (e.g. cell towers, internet), and it was essentially a very polished cobbling together of different components (microchips, batteries) that were developed from many decades of state supported / regulated monopoly research.
Business is very good at taking something off the shelf and making money with it. It's very bad at sustained investment that might not be profitable more than a few years away.
I mean, it'd make sense if the government research spending aligned with public interest more closely than private investment did, the government is spending the public's money after all.
Also, you are mistaken in thinking that, by publishing a patent, the company is sharing knowledge. Quite the contrary, the contents of a patent gives only the minimum necessary to protect a crucial aspect of a business secret. Most patents are opaque and don't give any concrete business information that be used to successfully replicate what it is trying to conceal.
In fact, until the US became top dog in the post-war era, we pirated everything we could from England, especially industrial know-how so that we could promote our own development. It is only after we reached hegemonic status that we started enforcing these ludicrous agreements in order to preserve our own businesses' position.