Of course, doing this only makes sense if what you gain outweighs the costs of performing such an attack.
If the hardware to accomplish the attack is available for your use, the cost of the mining should net out at zero-ish, because you're also getting the rewards for doing the mining. So the net cost of the attack is just the overhead for the mining hardware.
Coincidentally, economist Alex Tabarrok just wrote about this today: https://marginalrevolution.com/marginalrevolution/2019/01/bi...