Yes ... diameter increases when compressed. Not a lot, but it does. You can, if you want, calculate roughly how much by thinking of the space between two coils forming one side of a right angled triangle, half the outside diameter forming another side and the inside point on this line going to the next uppermost outer coil point as the hypotenuse. Pythagoras will give you the hypot length. Subtract half the od from this and you have the extra od you get from compressing the spring to coil bound. In essence, the hypot becomes the new od. Only approx but pretty good. This sounds complicated but if you draw it out it becomes easy.
I have know springs be a 'good' fit in a piston, or after fitting a piston sleeve, that they cannot be compressed to cock the rifle as the spring becomes too fat to compress in the piston.
Cheers, Phil