I do understand that sharing music with friends is not legal. What about sharing music with immediate family members; spouse, siblings, parents? Would that be illegal as well?
All that is covered in the license agreement you enter into when you accept the music. Different ways of distributing music have different agreements. You’d have to read yours to find the correct answer.