$\begingroup$

I wrote a blog post about this some time ago. The answer is yes, but by a tiny amount that you would never be able to measure: something like $10^{-14}\text{ g}$ (roughly) for a typical ~1TB hard drive.

That value comes from the formula for the potential energy of a pair of magnetic dipoles,

$$E = \frac{\mu_0}{4\pi}\frac{\mu_1 \mu_2 \cos\theta}{r^3}$$

In my post, I estimate that a hard drive might contain $10^{23}$ electrons total, split into $10^{12}$ magnetic domains which are spaced around $0.1\ \mathrm{\mu m}$ apart. That means the magnetic moment of each of these domains is $10^{11}\mu_B$, with $\mu_B = \frac{e\hbar}{2m_e}$ being the Bohr magneton. If you plug this into the formula above, and multiply by 4 under the assumption that each magnetic domain interacts with 4 nearest neighbors, you wind up finding that the total energy is no more than $5\text{ J}$, depending on the value of $\cos\theta$. That corresponds, via $E = mc^2$, to an equivalent mass of around $10^{-14}\text{ g}$.

Admittedly all of these numbers are rough order-of-magnitude estimates, and there are various other effects that contribute little bits to the energy, but any corrections aren't going to shift this by more than a couple of orders of magnitude one way or another. Given that the equivalent mass of the energy stored in the magnets is a full 17 orders of magnitude less than the mass of the hard drive itself, it's safe to say that the difference is undetectable.

Incidentally, I also tried out the equivalent calculation for flash memory in another blog post.