That's exactly what Apple believes.
From Tim Cook's testimony in Epic v. Apple, from Ars Technica:
> The in-app-purchasing (IAP) system itself, Cook said, is simply the most efficient way of collecting a 15 to 30 percent commission on each in-app sale. "If not for IAP, we’d have to come up with another system to invoice developers. It would be a mess."
This view is explicitly affirmed in the Epic v. Apple verdict[1]:
> Under all models, Apple would be entitled to a commission or licensing fee, even if IAP was optional.
The court found the 30% rate arbitrary but not objectionable[2]:
> Indeed, while the Court finds no basis for the specific rate chosen by Apple (i.e., the 30% rate) based on the record, the Court still concludes that Apple is entitled to some compensation for use of its intellectual property.
Personally, I don't approve of Apple feeling entitled to a cut of commerce that doesn't hit their app store, but the court's take (before appeals) is that it's perfectly legal.
[0]: https://arstechnica.com/gaming/2021/05/ceo-tim-cook-faces-po...
[1]: Page 67, https://s3.documentcloud.org/documents/21060631/apple-epic-j...
[2]: Page 150