I had the very same problem with my washer. I would be loading clothes in it
with the water running and after running awhile it would give me a shock if
I put my hands in it.
We had the washer tested and the grounds tested more than once. Had new
grounds placed on the whole house. No one could figure out what it was, two
electricians, and one washer repair man. I made sure I had tennis shoes on
when I washed clothes and kept my hands out of the water. What else could we
do if the professionals could not figure it out?
When the well pump went out we finally figured it out. The submerged pump
housing had vibrated against the well pipe 78 feet in the ground for years
and finally eroded a hole in the housing. Whenever the pump went on it sent
a shock up the 78 feet and along the metal pipes into my washer. This would
take a little while because the water pressure tank holds some water and
until it ran out and the pump came on the current was not there.
The new pump has a special rubber ring around it that prevents the housing
from hitting the pipe.
Don't know if this fits your problem, but it may have gone on for years with
no one able to find it had the pump not gone out.