Praise be to Allah.
This issue has to do with copyright, which is supported by sharee‘ah and Islamic teachings, and it is not permissible to transgress against it, because protecting this right serves the public interest, such as encouraging people to write and making them able to continue doing that, and preventing people from making money by stealing the work and efforts of others. Moreover, it is obligatory to fulfil contracts and adhere to conditions, because Allah, may He be exalted, says (interpretation of the meaning): “O you who have believed, fulfill [all] contracts” [al-Maa’idah 5:1]. And the Prophet (blessings and peace of Allah be upon him) said: “The Muslims are bound by their conditions.” Narrated by Abu Dawood (3594); classed as saheeh by al-Albaani in Saheeh Abi Dawood.
If the author or publisher states that it is not allowed to make copies, either for sale or for personal use, then you must abide by that, whilst taking into account the fact that making photocopies for personal use in this case will undoubtedly harm the author, because many students will no longer need to buy the material.
With regard to students contributing to buy a single copy to pass around among themselves, without photocopying it, there is nothing wrong with that, because there is no reason to disallow it.
And Allah knows best.