Question: Oh Virtuous Shaikh, is it allowed for the teacher to take some of the students things which are expensive. They play with it in the class during the explanation [ of the lesson], so [ the teacher] places it in the school?
Answer: “This is based on the permissibility of punishing by taking wealth. Some Scholars say: it is never allowed to punish by taking wealth except what is reported in a text. Some of them say: verily punishing by taking wealth is allowed and this is the more correct opinion. However, if it is found with a student something they are playing with [in the school], warn them on the board or on a sign or on other than that saying: anyone who comes [to school] with something to play with, then it will be confiscated. Then he can confiscate it.
However, if it is something expensive and the student is poor, for example, then here it is necessary to keep it safe in the school. At the end of year, it is returned to the student or his guardian”.
[Taken from: https://shamela.ws/browse.php/book-7686/page-1338 ]
Faisal ibn Abdul Qaadir Ibn Hassan