The best and most reliable way to get free textbooks is through the app Books by Courses from your school. It works as a search bar for different courses, filters them out by course level, and then lists those books which can be downloaded from their website without any cost or obligation. Professors might also provide some of these materials with footnotes on certain chapters if you contact your professor beforehand about it.