Iirc is to attract birds so it can infect the bird and use it to reproduce. After the bird has eaten the parasite out of the snail's eyeballs, the snail can often regenerate and keep living as usual. This is what I recall from a YouTube video at least ¯\_(ツ)_/¯