There is a huge selection of public domain ebooks (although admittedly less than there ought to be, with the ridiculous copyright extensions). Project Gutenberg has a lot of fairly decent quality .mobi and .epub versions out these days.
You can also get a decent amount of stuff from various Amazon programs, like Kindle Unlimited. The selection isn't always perfect, but it's not terrible either.
And of course, there are always slightly less legitimate venues for obtaining free ebooks. Your morality may vary, but I'm not sure I see a problem with torrenting an ebook if I already own the paper copy. (Thankfully, some publishers are starting to be reasonable about this, like Manning, and providing a free download if you've got the purchase code from the paper book. Others are not so great - I've tried to buy the ebook versions of some of my Apress books, and the questions that they ask to verify that you own the book, i.e. what page is figure 7-3 on?, cannot be answered correctly using the page numbers from the print edition...). There's also not the same level of organization by book publishers as the MPAA and RIAA.