One can always claim interoperability which is protected under anti-trust law (which we also have and we just struck Alibaba for ~US$3B anti-trust fine, and that is exactly the law that permitted Compaq and other IBM-compatible PC makers to exist alongside IBM.)
The first wave of IBM-PC clones were illegal. Here in New Zealand a PC-clone company called Exzel (?) were wiped out once IBM came after them and I'm sure there were some cases in the USA also.
It is legal to copy the hardware, but the BIOS code is copyrighted.
It wasn't until Phoenix clean-room reimplemented the BIOS -- one set of engineers documented what the IBM BIOS actually did, including bugs, and another set wrote bug-compatible code -- that IBM couldn't stop them. (COMPAQ earlier did the same thing, but only for their own use)
This is the main reason there were never any legal Mac clones. The IBM PC BIOS was 2k in size and rather badly written. The Mac ROM was 64k and written and rewritten to get it that small by very clever people such as Bill Atkinson and Andy Hertzfeld. QuickDraw was a work of genius, and at least one essential part, the Region Manager (responsible for representing arbitrary 2D shapes and clipping drawing to them and manipulating them with efficient union, difference etc operations), was patented.
That is why Chinese companies can make STM32 compatible products with its entire pinout, register layout and ID codes identical, and ST can do nothing with it unless they have still valid patents on some of the peripherals. Sadly for STM32F103 since all IP on that chip is either bought from a third party or lifted from the now patent-free STM8, there is no valid patent at all for them to base a suit on. The only thing ST can claim is the copyright on the built-in bootloader ROM, which is just way too easy to circumnavigate especially since those Chinese companies have zero willingness to keep the bootloader compatible and just rewrote it. This is likely also why you don't see code-compatible STM32F4 clones, as that chip has at least a redesigned GPIO controller that may be under patents, and no Chinese company will run the risk of being caught in a patent suit on that.
Just think ST being IBM, GD and CKS being Compaq, and Artery being that company that delivers PC compatibles with Phoenix BIOS and an NEC V20 in it. They run the exactly same code and have exactly the same external peripheral support. They bought the same components from the same external company (Intel for CPU and motherboard chips in IBM compatibles, versus ARM/Synopsys for CPU/USB IP in STM32 compatibles,) the compatible system makers reimplemented everything else (those custom IBM chips in PC versus that Faraday chip for IBM clones, versus reimplemented STM8 IP found in Chinese chips,) and there are also the brave ones that try to make improvements without breaking compatibility (the NEC V20 in a PC comaptible, versus the 240MHz Cortex-M4F in Artery chips)
As of the GD RISC-V chips, basically someone fitted an 65C816 onto an PC motherboard with an adapter.