Snails can come with plants, as eggs that have not yet hatched, and they can come floating in water with fish or shrimp too. MTS snails, new born, are so tiny they can float on the water tension and you might not even realize it's a snail at all, they can mimic a bit of gravel easily. I have even seen a clutch of snail eggs laid on a mystery snail's shell, only one time, don't know if they were ramshorn or bladder snails. I removed them.
MTS, btw, don't lay eggs in tanks. They have live young, usually they release them at night at the water surface, where they float 'til they find something to hang onto. Entirely harmless, they are voracious algae eaters and while they're small, they do their part to keep glass clean of algaes and eat up left overs. Good general scavengers, as are most snails.