I believe that purchased music does not transfer. (A leftover from the iPod model, where you got music onto an iPod by loading it from a computer,, synchronization was one-way from the computer to the iPod, and you could only synchronize against one computer/library at a time?)
If you are not using "iCloud Music Library" (that is, you're not using iTunes Match, and you don't have an Apple Music subscription where "Sync Library" is enabled), then I believe you would need to manually load purchased music onto the new iPhone. Either by
- Doing a manual synchronization agains the music library on your Mac or Windows PC, or
- Redownloading iTunes Store purchases
You might first need to do a manual synchronization to the new phone with NO music selected, to clear out the greyed-out music on the phone. ("Sync Library" copies from before ending an Apple Music subscription?!?)
If you are currently subscribing to iTunes Match, or are currently subscribing to Apple Music AND using "Sync Library", I'm not sure exactly what you should do to get things working. (Maybe turn off "Sync Library" on the phone, do a manual synchronization of NO music to the iPhone, then re-enable "Sync Library" on the phone – hoping that it will then do an "iCloud Music Library" synchronization with your computer?!? Just a wild guess. While I've had several iOS devices (an iPod touch, an iPad, and an iPhone), I've never upgraded a phone while subscribed to Apple Music and using "Sync Library".)