Let x=0.400m be the compression and mt=0.550kg the combined mass. Starting from rest at the top, it falls through H+x before maximum compression. Hence
The gravitational drop during compression must be included. Equating kx to the weight would instead describe a static equilibrium, not the turning point after a fall.