Not that this justifies the whole margin, but Apple runs a qualification suite on all products they sell on the stores or put into computers. This includes regular old compatibility testing - as in, the system works with xxx component, as well as a suite of EMI and reliability tests that make sure that these parts, in this particular configuration, pass local regulations. If you go out and buy ram and install it yourself, it doesn't have to pass FCC regs for interference with other devices, if Apple sells you a computer with it installed, it does. Because of this, Apple only sources parts from a few vendors. You would be shocked at the ways these components interact when put in a computer. The more variables (configurations x vendors per part), the more complex it is to complete qualifications. It sounds ridiculous when you only see it from the consumer side. Why is it that Apple charges 3-4 times more for the *same* memory? Well, for each memory configuration they need to test 20 computers for 2 weeks in a reliability lab. Assuming just 3 memory configurations (8, 16 and 32GB) you're talking 60 machines, now add the minimum of a single backup vendor, that's 120 machines. In reality, it's not that straight forward either, you get issues when you mix and match things like different hard drives, pci cards (on desktops), other chip vendors, processor speeds and die revisions.
All that said, yes, it's a pisser that Apple is finding yet another way to force everything you do to be under their thumb. But we're having this hissy fit because we all know we'll keep buying their products, at the end of the day, what they are doing is creating products we want, which other companies can not compete with.