Actually Apple makes a large profit on each device sold...so yes there are more relaxed cost constraints but it's not like they're eeking by and just barely making money on these.
The actual savings comes from Apples immense and immensely simplified manufacturing. Not only do they sell eleventeen billion of ONE product SKU (ok, some colors or extra flash but that's NBD). So Apple doesn't order 20% of battery A, 40% of battery B, 10% of C, etc....they order eleventeen billion of ONE battery. At that point they get it custom made to exactly what they want and for a substantial discount...they're well known for buying the entire factory output of a certain product for a given time. That's a big reason why the original iPod was the only device so small...they effectively (and realistically) bought the entire production of 1.8" hard drives.
Yes, they do use good materials and have extremely tight tolerances. Efficiency of scale. It's funny though, some people have chronic problems with connectors and cables - complaining about lightning, 30-pin, mini/micro-USB, etc. I never see to break my cables or connectors. Like...ever. I seriously have no idea what 'these people' are doing. I don't baby my electronics either!