Hyperfine magnetic anomaly in the atomic spectra of rare-earth elements