Admittedly, I am guessing that for example it costs Apple less to make the iPhone 4S (retail: $649) than it does Samsung to make the Galaxy SIII (retail: $599) just because of the beefier (quad core SoC) hardware in the SIII. Apple consistently manages to get as good or better performance from cheaper/older tech.
There's more to it than that. Apple's supply chain is extraordinarily efficient, keeping costs low.
In addition, Apple releases new models once a year and then sells tens of millions. Even Samsung's best-selling model doesn't have the volume of the iPhone and when you add in all their other dozens of models, the average production run is even lower. That costs money.
Apple's inventory management is superb - with only a few days' inventory. Samsung's presumably greater inventory (since Apple has been widely reported as having the greatest inventory turns in the industry) costs money not only in terms of carrying cost, but also storage and waste (some of those will eventually not be sold or sold at reduced price).
Working the other direction is the screen. Apple's screen is considerably better and probably costs more. OTOH, Apple doesn't yet have LTE chips in their phone and some Samsung models do.
All of those things are reasons why a simple back-of-the-envelope calculation is meaningless. It really requires a detailed evaluation.