1. To make a ton of money by extracting revenue from developers and content providers. This is the "obvious" goal everything immediately thinks of, but I think it's actually unlikely. Apple makes MUCH more money from device sales. It makes more financial sense to have a robust offering of content and apps. They are making good margins on their own services, but their business model in terms of the app/music stores is to run them just above break even.
2. Convenient payment. Not the reason, because Apple Pay would do that at a lower price.
3. Customer service. Since Apple is technically the merchant here reselling a digital good, they can also provide refunds and customer service. But I doubt they need a 15-30% margin for this. They could just contractually require that developers refund in-app Apple Pay transactions under certain conditions.
4. Privacy. Now here's a real reason. To offer a 2-3% fee, payment processors need to control for fraud. One way they do this is by verifying contact info. Now, for physical goods there is no way around asking for the billing address, so Apple Pay supports that. But it's not necessary for digital goods. Apple would not be able to offer Apple Pay for subscriptions without degrading user privacy.