AAC is pay for use codec and Apple receives royalties for its use through MPEG-LA. ALAC was historically proprietary, it was opened only after it lost to FLAC. Apple never supported any codec, that was really free, like Vorbis or FLAC.
It also provides them a bit of control over potential competition, that they would not have with really open codec. They also make it inconvenient from licensing/business model to use in some projects, see what trouble these codecs cause to projects like Mozilla/Opera, Linux distributions, XBMC, VLC etc, which does hamper them significantly.
For Apple, that's competitive advantage.
I'm not sure Apple is even that concerned about the competition from such projects — all their major competitors have no issue with paying the licensing charges.
It's worthwhile pointing out that Mozilla nowadays use H.264/AAC/MP3 support from the platform layer, as does Opera (though, yes, most Linux distributions do not ship such things by default — but that's a small percentage of the market) — and in Opera's case the argument to not support it was always one of philosophy (avoiding giving themselves a competitive advantage that works against a free and open web) rather than one of finance (Opera has plenty of revenue to pay for the license).
When there were all the discussions around HTML5 and mandated video codecs the reasons that Apple publicly put forward seem reasonable from their point-of-view: supporting video codecs that no major company has previously shipped bears a risk of patent infringement cases (and defending such cases is expensive, even if your odds of winning them are good!) that might result in huge fines/compensation. When the majority of the content on the web was already using H.264 (and it seemed dubious that many sites would support more than just H.264 unless everyone dropped H.264 support, which seemed highly unlikely to happen), there was no compelling market reason to take on that risk. The de-facto state was the web already relied on a non-free codec, and mandating a free one was only of marginal benefit if nobody started using it (yes, it provides a free common baseline, but de-facto everyone has to support H.264 as a baseline anyway, however sad that is). This isn't so malicious as it is accepting the reality of the market, sadly.
When almost all browser installs support H.264 already, you may as well use it for WebRTC. Would it be nice if the web didn't rely on H.264? Yes. But we're already at a point of relying on it, so we may as well rely on it elsewhere.