The secret: tie-ins.
When you buy certain textbooks, like my math and physics book, you now get a code. This code grants you temporary access to a website operated by the publisher. The code can only be used the once and gets tied to your student number.
Why does this matter? Because this website is how you submit your assignments. Without it, you get a mark of zero. The profs like it because the website automatically and instantly grades everything for them, which I’m sure is also appreciated by the teaching assistants.
You do have the option of buying the code on its own. But the extremely high price of the code ($60) means that buying it and a used textbook would cost more than a new textbook.
I’m evidently not a fan of this dynamic.