Yes it is specifically legal, though the music companies clearly wish it wasn't.
Another advantage to CDs is that they will work with any of the software, players or copy protection schemes, iTunes, Zune, WMA, "Play for Sure" (which doesnt'), etc...
You can also pick your self what kind of trade off between compression and file size you want to make (which is often not the case with downloaded tracks). Also should you change your mind you can re-rip and compress. An option not typically the case with downloaded files.
You can also install the iTunes or Microsoft ware and use it to browse their stores (they all have previews of varying length) to find music you like and then just go buy the CD.