Songs that are part of the Apple Music subscription are not purchased. The subscription gives access to the catalog while the subscription lasts, and when logged in with the proper credentials (Apple ID).
Songs that were purchased from the iTunes Store are different, and are not dependent of a subscription.
If you use the same Apple ID on both devices, then you can have access to the same content. Also, you may re-download a purchased song on any of your devices that have the corresponding Apple ID, from your purchase history.
If you use different Apple ID on these devices, then music on one may not be available on the other device.