Is it bad to listen to music loudly? Is it better to listen to music loudly through earphones?

Yes, bad! Loud music, through an earphone or not, can cause hearing loss.
Loud=hearing loss. It doesn't matter whether it is from speakers or headphones, loud noises cause hearing loss. The louder the sound, the faster the hearing loss. Studies have shown temporary injury to the cochlea with ipods set at 50% volume. Leave the tunes as low as possible. Also consider n-acetyl choline if you have noise exposure to help reduce risk of hearing loss (firearms, concert, etc) best wishes!