When using redirect output in bash, how is the owner and group of the file determined? [duplicate]

On the bash command line, I am in a directory with permissions rwxrwxr-x with an owner and group named web. When I use the command sudo touch foo, the file has an owner and group of root as expected. But when I use the command sudo ls > bar, the file has an owner and group of web which I did not expect. Why is this?