The answer would be that some people will pay for it. They obviously don't care about selling a ton of memory chips, so their price is optimized for something else.
A similar situation may happen as a contractor: there may be gigs that you'd rather not take, so you will ask for an ridiculous hourly rate (say $700/hour). If they pay for it, oh well.
Installing memory is probably a lot of fuss, especially for such a streamlined manufacturing process, and they can't post a fluctuating market price, so they just post one they can live with no matter the circumstances.
This is why you buy from Other World Computing http://www.macsales.com/ Awesome support. No, I don't work there, I just have been buying upgrades for many many many years there, including a new SSD yesterday.
I also bought the same memory today. I have 4 GB of Crucial currently in my MacBook that I bought last year for $77: the same memory is $20-30 now. I've had no problems at all so I don't expect any issues with the 8 GB sticks.
I'm only half-joking. If you look at the comments, you'll find people who were referred to buy this product from Apple's customer service representatives. These people probably know diddly about RAM, and they're ultimately paying for the recommendation moreso than the product. Apple isn't everyone's favorite company, but their customer service is top-notch, and this is no exception.
That's not to say it is a totally fair price, but that's why they can price it like they do.
I share your general sentiment, but would add that their phone support is particularly as terrible as Dell's, though their Genius bar and probably their business-level services are top-notch.
Generally their prices for memory is never reduced until a model is updated. So early on in a product's life the price is more competitive. I once heard it was because Apple buys a ton of it up front (and gets a better price on it as a result), then just keeps that price. I have no idea how true that is.
Having just bought a $2200 Macbook Pro, the mark-up is definitely hard to ignore (a Dell XPS laptop with equal or better specs comes out to $1400 - admittedly without the Mac OS). However, because they can command such a high mark-up, it's easier for them to charge more for upgrades, e.g. $200 to upgrade from 4GB to 8GB which would still be a 5x markup.
It's likely that Apple knows that people who care about the price, e.g. tech people, are probably not going to pay much above the market rate for it. However, the people who aren't as tech-knowledgeable, e.g. aren't familiar with the going price, are far less sensitive to the price and therefore, they can charge substantially more.
I was talking with a former Apple server division employee (from Cupertino) and was laughing at the insane RAM upgrade pricing costs compared to Crucial and other vendors.
He acknowledged that they were pretty high, but said that this is because Apple is overly careful about vendor selection and testing of the RAM itself. This ensures that it'll work best when installed in Apple hardware and won't cause unexpected and subtle errors down the road (as cheap RAM can sometimes do).
I still think Apple RAM is massively overpriced, but this makes sense to me. Also, if you upgrade from 4GB to 8GB when ordering a new build-to-order system the cost drops to $200 (from the $400 quoted here).
So, I just spent a few minutes trying to answer the following question: If I were uncomfortable about buying and installing my own RAM, and I went to Google to find a local store that would install RAM for me, what could I find?
I see Geek Squad trucks driving around all the time, and I happen to know (via other more extensive Google searches) that Geek Squad will install RAM for $50, if I miraculously manage to buy the RAM and bring it in to them with the computer. Awesome! Presumably they can also help me find the RAM in their Best Buy store and buy it.
But when I search "geek squad install mac memory" do I get a nice landing page? Nope, I get a generic ad leading to a generic landing page that doesn't mention memory but offers to sell me a $99/year support subscription that includes such helpful stuff as "antivirus". Given that I've just bought an Apple device and - however naive I am - probably understand that this comes with free Genius Bar support, I'm going to click away from that page and never return.
Now, I happen to live in a town with a Micro Center, so I Google up "micro center mac memory", and do I get my landing page? Nope. Top result is an ad directly from Apple for their $400 RAM. Below that is an ad from Crucial that leads to a page which requires me to read words like "DDR" and know that my machine is a "2.2 GHz early-2011" model. Then there's a similar ad from "MacMemory.com" that leads to a page that makes Crucial's look like a model of UX design. And finally there's a bunch of links to Micro Center, several of which lead to computers but not RAM, a few of which lead to catalog entries for RAM complete with the DDRs and the GHz and the scary photos of green circuit boards, but none of which suggest the known fact that Micro Center has a tech shop in house and that shop will install RAM for you.
Even typing "Boston mac memory upgrade" only gives me one local store link on the SERP:
... and that's not a great landing page. Nothing specific to my problem. Most particularly: No price. But they do offer to ask me lots and lots of questions as they get to know me and my very personal problems with my personal computer. Techies: as a non-techie I probably don't yearn to open a dialogue with you, partly because I know I'll be mortally embarrassed by the conversation, and partly out of fear that you will try to convince me to spend hundreds of dollars using words which I cannot understand or rebut. Whereas I know that if I pay the nice Apple guy four hundred bucks my computer will vanish for fifteen minutes, magically reappear with more memory, and that's it.
So my answer is: Apparently Apple gets to charge their prices because nobody else in the league knows how to play this game.
On top of that, you prevent that, if something is wrong, you end up in a blame game (the computer must be defective/you asked for the wrong memory modules/etc).
There also is the possibility that Apple's stuff is better, even though it comes from the same factory. For example, Apple could have every RAM module run for months at above-spec frequency, temperature and humidity to weed out bad modules. I do not think they do such severe things, but I do think (without having any evidence, except for the 'evidence' of their pricing) that they buy slightly/somewhat better batches. That does not guarantee that their products are better, but it will weed out the almost-dead-on-arrival ones.
It seems to fluctuate. I don't track it closely, but I know that there have been times I've bought machines and the memory from Apple was close enough in price to OWC or Crucial that I just went ahead and bought it from them for the convenience. And there have been times that it was so out of whack I didn't even consider it. It's always more expensive, but not always this bad.
Apple has been doing this for many years now. I think we all know the reason why they do it. Answer: because they can. Don't shop at Apple expecting to find a deal.
A similar situation may happen as a contractor: there may be gigs that you'd rather not take, so you will ask for an ridiculous hourly rate (say $700/hour). If they pay for it, oh well.