Xboxes have always been sold at a loss and then Microsoft makes back its money via games.
https://www.makeuseof.com/microsoft-confirms-its-selling-xbo...
https://www.makeuseof.com/microsoft-confirms-its-selling-xbo...
Nintendo (like Apple) needs to recoup R&D and software development costs, and their business model is based on charging platform fees.
It's completely unsurprising that Apple's gaming handheld uses a similar walled garden/platform fee business model similar to Nintendo's.