So I thought I'd provide a little clarity on this situation as it's a bit misconstrued. To do this we need a mild history lesson.
KTM Motorcycles are owned by a company called Pierer Mobility AG and (Bajaj from India) in Austria and have been for roughly 30 years. Pierer have slowly been aquiring other brands along their journey from bankruptcy (twice in the time) to being a European heavyweight brand.
KTM as a brand are kind of similar to 'Dunlop' or 'Husqvarna'. They are not all the same company but mulitple companies who own naming rights. KTM motorcycles and KTM bicycles are entirely seperate companies under different ownership. This was split when they originally went bankrupt.
Along the way, the owner Stefan Pierer decided to start diversifying. It started with Husaberg motorcycles (Swedish). They then purchased Husqvarna motorcycles from BMW and kept only the name. The physical assets were sold to a chinese company who badged them SWM.
GasGas is the newest aquisition and they repeateded the process. Sell some of the assets, keep the name and some products (their trials bikes and some e-mobility stuff). I don't know quite where Raymon Biycles fits into this equation but they are also owned by the same group.
Pierer also owns motorcycle suspension brand WP and a few other things that help keep the cost of KTM group production down. They have repeatedly attempted to purchase the KTM bicycle brand during this time but failed to do so.
And that lands us at the emtb situation. The GasGas range (which seams to be their lead direction currently) and the Raymon range are identical bikes with red paint and a GasGas logo on them. The Husqvarna range is the same.
This is a very Pierer thing to do and has been incredibly succesful in off-road motorcycles, mostly because they make incredibly good motorcycles.
TLDR;
KTM motorcycles not the same as KTM MTB's. KTM, Husqvarna, GasGas and Raymon are the same company. GasGas and Husqvarna emtbs are Raymon.
Source; I am a motorcycle journalist.