Recent research from iSuppli shows that even though the iPhone 4S is more expensive than the Lumia 900, Apple actually pays less per part than Nokia does. The biggest individual price difference is between displays; Apple pays $37 for theirs, Nokia pays $58. All told, Apple pays $190 in parts, while Nokia pays $209, which leads to Nokia making a $241 margin per device, and Apple making $459.
To be fair, Apple has some pretty great agreements in place with manufacturers thanks in no small part to the massive scale at which they place orders, plus the Lumia 900 has a bigger screen and an LTE antenna to pay for. In any case, when boiling costs down to a per-device basis, it's easy to see why Apple is sitting on a mountain of cash. You would think that Nokia would have mastered churning out a bajillionty phones at scale and reaping the benefits of scale, but those glory days of the dumbphone reign are long gone, and clearly not translating well to their future in smartphones.
As much as we can on Nokia for having such slim margins, that's more a result of their market position rather than cause of it; Windows Phone is still very young, and even though it's set to overtake BlackBerry market share given its current momentum, it will be a long time still before Nokia (or anyone else) will be able to see the same margins as Apple.