From what I understand of the law (US law), If you have purchased a CD, then you are allowed to rip the music from it and use the mp3s on any device you own.* This is called format shifting
and is perfectly legal.* In some countries like the UK (I think) format shifting is not legal.
When you give a copy to someone else you (may) be breaking the law.
* I am not a lawyer, nor an expert, and this is not legal advice
To learn more on the legalities, I highly encourage people to visit the EFF website:
And a few others that may be helpful:
Copyright - Wikipedia, the free encyclopedia
Chilling Effects Clearinghouse