Way back in the day Apple constructed a system designed to let you copy music to their devices, but not easily copy it off. This helped get the record companies onboard with digital music because it minimized the risk of people using iPods to casually share music with each other. It won't have hurt that Apple also applied DRM in the early days. Although DRM is no longer added to music Apple haven't changed the way media content is hidden on a device. When you connect an Apple device to a computer you don't get direct access to the media files. For older devices you can explore hidden files and folders can copy the randomly named files into an iTunes library in order to reconstruct them from their internal metadata. With an iPhone or iPad software like iFunBox can give you access to the raw file system of the device so you can do the same thing, or you can use commercial software to extract the media. There are options. A short term subscription to Apple Music can help to rescue non-Apple purchases from a device but that won't work for purchases that Apple might be blocking access to for reasons unknown, or come from a different Apple ID or region. The method I've suggested should give you everything.
With iPhone Apple added some additional limitations only allowing it to be manually managed from a single computer (no idea why) and if the device is synced it won't necessarily display the content, or at least it may only show it as a greyed out list of songs that cannot be played or accessed.
tt2