When I was in college (two years ago) I would initially search for books on amazon and chegg, focusing on the cheapest book available for the version the syllabus required. In my experienced as an Accounting Major, there were traditionally one or two significant books that were required for assignments, studying ,etc. that needed to be possessed, and often some optional books (which I would never purchase). I much preferred renting whenever possible, given I had no use for books after completing the class and often professors use newer versions in the future, which might affect the resale value if you owned a book that became obsolete. Some books are cheaper on pdf/kindle if that is something you'd be interested in, but definitely research several sites to find the cheapest rental options, or if not available, the cheapest book. If you're required to buy a book that you need for a class, potentially asking friends or peers if they are planning to take the same course might serve you well, as you could determine a price that is fair for both of you instead of needing to sell the book back to a 3rd party reseller (who will take a profit).
For me, 'better' may vary in choosing between the two. I agree with the other comments about checking for cheaper options, checking with your professor and checking the subject.
Personally, I did a mix of buying and borrowing. For books that I was required to have for readings/homework/assignments/etc., I did check online for cheaper options as well as check for delivery options to my location (to see if I could get it in time for when I needed it). Another option I did was to check for used book sellers in my area and compared prices with online. At the same time, I checked with the sellers regarding the condition of the books because I personally don't like books full of highlights/question answers written on the pages/etc. Then for books that would require some reading but not heavy usage, I checked if it was possible to borrow those, my preference was the library. To add, I borrowed more books than I bought. I didn't get textbooks for all my subjects.
There have been instances where certain books weren't required readings but I really enjoyed the content so went ahead and purchased the book. There was also a class I had where it was an elective, not a major, but it was a class I am highly interested in and really enjoyed, so I also went and got the textbook. (I always try to look for cheaper options online when I buy)
Also note, I had classes where readings were from different sources that our professors provided, so I had a few classes where major readings were not from textbooks and I didn't buy/borrow any books for those classes.
Hope this helps!
Sheena recommends the following next steps:
It is better to rent books for "general education" classes. These are classes that everyone had to take, and you can get these book easy. It would be good to buy the books that are in your major. Books in your major will help you when you get placed in the job that you want.