However, the actual length of the spring has not changed. The atoms that make up the spring are still the same distance apart, they are just arranged in a different way. If you remove the weight, the spring will return to its original length.
So, while the pull of gravity can cause an object to deform, it does not actually change the length of the object.