It’s actually a big machlokes poskim as to whether copying music is allowed.
as for dinah d’malchusah, I was told it’s not an issue as long as you’re not downloading on a massive scale or selling what you’ve downloaded. The reasoning was that if you call a record company and tell them you downloaded their album, they’ll tell you not to do it again, and that’s all – they won’t try to come after you. If they won’t come after you, it’s not a problem of dinah d’malchusah.