Goldfish and waterlilies work fine together. Koi a different story. Koi dig, the bigger they get the more they dig. Stopping them from digging is the biggest challenge. Building a basket the allows the lily to come out through the middle but keep the koi out is the best option but can be a little of a challenge to make one that works good and yet doesn't cut the fish up. Another less effective way but it does work is place a layer of rock on the surface of the pot that they koi either don't like, (Lave rock or feather rock) or large stones, (Bigger than they can possibly move). I prefer using lava rock that is a little larger than a golfball. koi usually will leave them alone. For goldfish, I just plant in 8-10" of clay sand mix and put a small layer of pea gravel and it's always worked just fine with almost no muddying up of the water and good plant growth.