I was visiting a cranberry farm, and they had plants that were floating on water when it wasn't harvest time, so it made me wonder: Do cranberries need soil, or can they just be allowed to float forever, and still produce?
We don't know what you actually saw, but cranberries don't grow either floating on water, or under water.
The plants grow in a bog, and are vines up to 6 feet long.
They are often harvested by flooding the bog and stirring the water with machinery, which makes the ripe berries break off the vines and float. They can then be collected mechanically. For making cranberry sauce on a commercial scale the berries are going to be crushed anyway, so damaging them during harvesting doesn't matter much.
The bog may also be flooded in winter when the plants are dormant, so that the water with a layer of ice on top protects the plants from extreme cold. They need winter temperatures that are near freezing for several months each winter, but they won't tolerate temperatures a long way below freezing.