> It is often legal, or borderline legal if you have good lawyers.

yes. and it's even worse than many think. just look at the 'trade secret + patent' sandwich:

“Patents are typically viewed as a cornerstone of intellectual property licensing. The licensing landscape, however, has been changing. In recent years, trade secrets have become “the crown jewels of corporations” and “workhorse[s] of technology transfer.” Recent court decisions on trade secret misappropriation exhibit damage awards that are in the hundreds of millions or even billions of dollars, indicating how valuable trade secrets are to companies.

Trade secrets cover 90% of all new technology; “over 80% of all license and technology transfer agreements cover proprietary know-how (trade secrets) or are hybrid agreements covering both patents and trade secrets.” Therefore, it is virtually impossible to license a patent without also transferring applicable proprietary knowledge and information. As there is always more to every invention and certain information inevitably escapes a patent application, some commentators asserted that “a patent [is a] little more than an advertisement for the sale of accompanying know-how.””

[...]

"[An]other important caveat in understanding the true value of trade secrets is that even information about what not to do may be extremely important in gaining competitive advantage. For example, negative research and development results may not only increase the amount of available proprietary knowledge, but may also expedite commercialization by competitors if such information becomes known to competitors.“ [1]

In an article called Don’t Be Fooled by His Patent Purge: Elon Musk is Just Another Hypocritical Tech Billionaire, Paul Morinville writes:

“[W]hen an invention could be patented, keeping it as a trade secret denies the public knowledge of how the invention works, which in turn denies the public the ability to improve, combine, or invent around the invention.”

[...]

"It is exceedingly rare that an inventor comes up with something completely new. Virtually all inventions are the result of combining existing elements and adding something new."

[...]

"[Yet] trade secrets have become the preferred invention protection choice of many tech multinationals. Many of these companies have huge numbers of customers with thin products that run on or behind internet browsers. Most inventions in these fields can be hidden behind the browser, buried in the bowels of a datacenter, encrypted in code, or embedded in a chip and thus easily protected by trade secrets.

In emerging fields, technology advances at a lightning fast pace. Improvements invented by others could bring disastrous disruption to incumbents. In Tesla’s market for electric cars, dry electrode batteries may be that disruptive technology given the $218 million price tag Tesla paid to obtain the trade secrets.

The greatest threat to the very existence of these huge multinationals is creative destruction at the hands of someone who invents something that their customers want that they did not think of first.

As a result, none of these huge multinationals wants anyone else to learn how their inventions work because someone else could improve it, combine it, or invent around it, which could disrupt their business.

Hiding inventions as trade secrets acts to protect these huge multinational corporations against this threat of creative destruction. This is the reason that huge multinationals lobby so hard for strong trade secret laws and weak patent laws. This is clearly shown in Musk’s low valuation of his patents and high valuation of trade secrets.

Trade secret protection for inventions that could otherwise be patented is bad public policy because it stifles the progress of innovation and it consolidates money, markets and power into a few huge corporations that become immune to the threat of creative destruction."

[1] https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2334060

[2] https://www.ipwatchdog.com/2019/02/19/dont-fooled-patent-pur...