Apple made nearly $190 billion last year selling just iPhones.
If you think it costs more than $5 billion to design a phone and set up a production line, you are wildly off base. That’s the kind of money companies spend to build silicon fabs or release half a dozen new car models, not consumer products made by a contract manufacturer.
...you do know that Apple produces its own silicon, and probably uses about an entire TSMC fab's worth of capacity? In the end, the money to build that fab is coming from Apple.
Apple isn't making average consumer products with average contract manufacturers.