The first year of the Bunji era (1185) was the year of the Snake. In this year, on the day of the snake, in the month of the snake, Minamoto Yoritomo had a dream in which the god, Ugafukujin, delivered a divine message. He was told: “In the valley to the northwest, there is a miraculous spring that gushes out of the rocks. Go there and worship the gods of Shinto, and peace will come to the people.”

He found the spring as it had been described, and immediately enshrine Ugafukujin. So it is said that the shrine was established, with the spring water being used in Shinto memorial services.

It is believed that if you spend money that has been washed in the spring water, it will increase many times and come back to you. — From the plaque at the entrance tunnel to the shrine

The water of the spring inside the cave is supposed to have the power to multiply the money it comes in contact with. This unique tradition of coming to wash your coins began in 1257 when Hojo Tokiyori came here and washed his coins with the spring water, expressing the hope that they may be doubled. People heard the story, and the tradition was born. — Wikipedia