You can buy Pokemon music through sites like Amazon and on iTunes. I think that is mostly stuff from the anime.
If you want music direct from the games there aren't really any legit sources. However there are many YouTube videos that just play a theme from a town or route in the games. You can download YouTube videos using sites like keepvid.com but I don't know of any easy way to download the music separately.