As everyone else has said, depends on the course really. Some subjects (often science-related ones) will have a couple of central texts with all the core knowledge that it's worth buying and then use libraries for the more peripheral or specialised stuff. For Law there tends to be one or two central textbooks that cover everything for each topic, plus statute books, all of which you really need to buy so you can end up dropping over £200 a year. On the flipside, some of my friends doing History and the like have lived entirely out of the library because they need to read so many different, niche books.
As a general rule of thumb, the more people there are doing your course and the more comprehensive the textbooks tend to be, the more you stand to gain by buying them.