How does Apple Music prevent you from keeping offline music after cancelling your plan? Apple Music allows you to download an unlimited number of songs onto your phone or computer and then listen to them while not connected to the internet. What prevents someone from subscribing to Apple Music, downloading a large number of songs, and then stopping their subscription?

I assume that when you try to play a song, even one that is downloaded, the software (iTunes or the iOS Music app) checks your account status to ensure you are still an Apple Music subscriber. But what if you keep the device off of the internet? Apple would have no way of knowing if you are still a subscriber or not.

The only thing I can think of is that the songs have some sort of timestamp on them tracking when the service last verified your account; and that they will stop working after some period of time if it is not verified again. If this is how it is done, what is that time period? How long can you go without connecting to the internet while listening to a song downloaded from Apple Music?
They store the tracks in a different location than normal music and validate your subscription periodically when you play the files. 

I believe the check in are quite rare as the system only promopts to renew tokens if you don’t otherwise connect regularly. I’ve seen it maybe three times a year lately. Even being offline a month, the token isn’t expiring in my experience. 

This system seems designed to make it easy to re-up and give people latitude and runway in the mean time rather than to prevent any and all short term gaps. Clearly, if you’re online when you cancel, music would and should expire the music, but I’m not seeing that happen aggressively when you still pay for the service in practice or it lapses at the end of a subscription period.