The beneficial bacteria are not planktonic, and a UV sterilizer only effects what flows thru it, as backfromthedead and others have said, the good bacteria live as biofilm on surfaces like the bio media in your filter, tank walls, and decor.
This is one of the reasons saving old water to cycle a new tank is a useless endeavor, while saving substrate and media, will cycle a new tank almost immediately.