If I had to guess, I'd say the solenoid valve was shutting off too fast and stopping the flow of the water before the pump motor was off. Since there would still be the force of the water, it has to be absorbed in the piping, which is most likely type L hard copper. The copper pipe basicly flexes when a solenoid valve closes and sometimes after a few years of expansion and contraction, bangs against the inside of the holes drilled in the studs and walls.
I could be wrong though.:)