Unless someone else had access to it, made it available online as a public "free" download and they found it by searching for it. No hacking or fraud was necessary there (by the students at least)
For example, when I was a student the professor assigned even numbered problems so that the answers wouldn't be in the back of the linear algebra book. However, I found a PDF online that contained all answers with solutions! I didn't have to hack anything.
Even if the teachers' resources are secured better than that, it must be nearly impossible to prevent all of their customers from posting those questions online -- most of my profs post assignments online rather than giving out hard copies because it is just more convenient for both them and us this way. Some of those questions come from the textbook; I don't know how many come from some other teachers' resource. I know I've stumbled upon other profs using some of the same questions, and sometimes even answer keys, because I Googled some terminology I didn't understand which was apparently unique to that publisher.