If the teacher says 'okay I' m confiscating the phone' and stretches out his hand but the kid just puts the phone back in their pocket, what do you want the teacher to do?
It's a school. The adults have authority over the children. If there's really no way to enforce the rules or punish bad behaviour, the entire institution is a joke.