People are making a things way too hard. The old way still works. Manage your music using the native app on Macs or iTunes for Windows, sync with iPhone. Music you buy from Apple has been DRM free since 2009.
Apple has always sold 256KB AAC and most of their songs they sell are now lossless ALAC. Yes itβs open source and Apple provides open source implementations to convert to other lossless formats.