Other phone manufacturers get monies from phones other than the selling price (ad revenue, money from eg Facebook for preinstalling their app, revenue from their on-phone un-uninstallable stores, etc). Like printers or gaming consoles, the hardware is subsidised.
(And ofc scale, that's a huge hurdle on it's own.)
The price is kinda ok on this one.