It's not a magnet, but it is a ferrous lump of ... something ferrous, I suppose. It's usually kinda like a hard version of pot metal.
My extremely tenuous grasp of the theory is that it works something like a very low value inductor, trapping the noise out of the cable -- but mine is a very, very tenuous grasp, indeed, it's been way too long.
The short, practical version is that it reduces the RF noise on the line, which, of course, improves the signal to noise ratio.