When I upgrade from an iPod Touch to an iPhone I needed to move my iTunes library from one device to the other. I searched near and wide for an program that would allow me to do this and ended up purchasing at least 3 programs that just didn't work with either the iPhone or the iPod Touch! I finally found one that did the trick - TouchCopy from Wide Angle Software, available for both the Mac and the PC for only $24.99!
TouchCopy performed the job phenomenally (a trial version is available). In addition, it allowed me to transfer music (playlists, ratings, album art, i.e.), TouchCopy also allowed me to access my photos and videos (it also let's you to manage contacts and calendars on certain iPod versions). Probably the coolest features of TouchCopy for power users is the ability to manage your iPhone or iPod Touch like an external hard drive! Some will find TouchCopy's user interface a bit dated, but its packed with great features and functionality.
If the music you are transferring was ripped from CDs it will be playable without restrictions. Music from the iTunes music store, however, must be “authorized” to play on your iPhone. I was able to successfully transfer my playlists from my iPod Touch to my Mac, then from my Mac back to my iPhone in record time. TouchCopy has ended up being one of my best iPhone investments!