Do we know where they get the prices for all the parts?
The prices aren't what was reported. It was the cost that was estimated. Once you teardown, open up, slice and photograph the chips, you will have a very good estimate of how much each piece of silicon of a certain size and technology cost to fabricate, package and test. How each chip is then priced in the COG is an accounting game after a game of high level negotiation between Apple and each vendor, possibly for multi-component multi-year deals. Whatever profit Apple isn't making on some component, some vendor is in exchange. But my guess is that Apple is very very good at vendor price negotiations. They do not pay list prices, so those aren't very relevant.
Also, R&D (look up "sunk costs") and overhead are different line items, not part of marginal COG sold.