YouTube Music has three models:
Free, but you get ads. If you access using a Google account you can skip the ads after a few seconds. Most content is available in offline mode.
Basic subscription, and premium subscription. Both have no ads, and all content is available in offline mode.
The music is properly licenced and the ads or subscriptions pay for the content providers.