Big companies like Apple instead of bringing the money back they borrow billions of dollars at low interest rates. This lets them keep their money offshore where they invest it to make a bigger return then their interest rate on borrowing in the US.
Apple also has a routine for money in the US. You will find in Nevada Apple has an investment corporation. They will do the same thing, send the ownership of software to Nevada, charge their company in some xyz state (CA) and then they use that money in Nevada to invest it for more money then it costs them to borrow. So apple is covered both ways.
https://en.wikipedia.org/wiki/Braeburn_Capital#:~:text=Braeb....
https://www.businessinsider.com/how-apple-dodges-billions-in...