You (or your parents, if you are under 18) agree to certain terms - e.g. Code of Student Conduct - when you enroll and start attending public school. If one of the rules is that you may not bring your cell phone to school, and that if you are caught with a cell phone, it can be confiscated, it's legal. If they require you to pay a fee to get your phone back in the rules, that's also legal.
If you don't like the rule, then appeal to the SCHOOL BOARD. You can also contact the SUPERINTENDANT of your school district. These are the people who have the power to change the rules, or to get the ball in motion. If enough parents and/or students disagree with a rule, you can often times persuade them to take it off the books.
Good luck to you.
NOTE: This answer is made available by the lawyer for educational purposes only. By using or participating in this site you understand that there is no attorney client privilege between you and the attorney responding. This site should not be used as a substitute for competent legal advice from a licensed professional attorney that practices in the subject practice discipline and with whom you have an atttorney client relationship along with all the privileges that relationship provides. The law changes frequently and varies from jurisdiction to jurisdiction. The information and materials provided are general in nature, and may not apply to a specific factual or legal circumstance described in the question.