It's a LOT more complicated, considering the iPhone's BOM contains probably about 90-95% CUSTOM parts, the costs of which simply CANNOT BE KNOWN.You are correct the contracts are secret and these estimates are just that. If a part cost $4 to manufacture and the market wholesale price is $6, these companies will make a guess that apple buys it for $5 as they have massive purchasing power. You are correct that the $5 number is a guess but it is a educated guess by people that do this stuff all day. A BS number would be if the company writes down that apple pays $8 for a part which people can buy for $6 for they pay $3 for a part that has a cost of $4 to make.
It's is more complicated than the above, but I think I would be wasting my time trying to explain it to you.
How much does Apple pay for an Apple APL1W72 A11 Bionic SoC?
How much for the Apple 338S00341-B1 power management IC?
How much for the Apple 338S00248 audio codec?
How much for the Apple 338S00306 power management IC?
How much for the Apple/Murata USI 170821 339S00397 WiFi / Bluetooth module?
How much for the Apple/Cirrus Logic 338S00296 audio amplifier?
How much for the mystery STMicro IC on the OLED Display, 10 THADT733 X-139U?
How much for a zillion CUSTOM flex-strips, ribbon cables, and flexPCBs?
How much for the hideously high-density main logic PCB itself?
How much for the custom-formed-and-punched Stainless Steel case?
How much for the custom Li-On cells?
Lots of questions, very few hard answers.
Look at that picture of the iPhone X layed-out. How many of those components you see are off-the-shelf?
Answer: Practically NONE. Well, that's EXACTLY how much knowledge ANYONE outside of Apple has as to the Costs of those items!
https://www.ifixit.com/Teardown/iPhone+X+Teardown/98975