A reason why some would believe that they a form of punishment is because, if a popular website is blocked, it typically ends up punishing the majority, because now a website they used is blocked, even if most of them abided by the rules of the school.
There times when web filters can block useful websites that contain information needed for a paper, or assignment that a student needs, purely because of content that the filter could mark as "sensitive content".
At their worst, web filters can be a form of censorship, if the administrators running the school or library hold a certain viewpoint, they can, if they wanted to, use these filters to block out certain viewpoints if they disagree, which is sadly very common.