Besides everything that has already been said, the biggest problem is stealing someone's finished work without referring to the original author. However, you did not do this. The moral deviant here isn't you - and no legal consequences are going to will to you. 

Let me try to explain why. 

The open-access or on libgen books are more downloaded and cited than others behind the paywalls. A lot of studies are finding this (e.g. see https://blogs.lse.ac.uk/impactofsocialsciences/2017/11/22/open-access-books-are-downloaded-cited-and-mentioned-more-than-non-oa-books). And considering that the scientists will do their jobs aiming large range of readers as well they are already paid for the development of their studies by private or public institutions, seems like ok if you read books from libgen and do the reference. Imagine that you could borrow the book from one friend or the library school.


Besides that, assuming you are not making any harm to nobody as well as helping to amplify the reach of those studies, in fact, you are helping people to access knowledge. (And knowledge must be free for all!!)

Nevertheless, if you not confident yet and have the conditions to reimburse, so you could just send the money directly to the author. Because, in the end, she/he receives a little part of the price!!! If you take into account that the big publishers are who retaining the money and not the authors, using libgen and sci-hub is a big favor for the authors.

It is especially true outside of renamed US and EU universities, we don't have money to access knowledge and don't have a choice. Is very common to ask for the authors for their work if isn't present on the web for free.

Resuming: 

- The money from the sales goes almost all to the editors. 
- Science needs been free to disseminate and contribute to the progress of knowledge.
- As the first goal, authors want more to amplify their reach than get rich. 
- Ok, that's necessary some kind of retribution to the scientists work, but the books are a very little part of their budget. 
-  And there is no possibility for many young or/and poor researchers to buy books.
- by the end, you could read them at the library or even borrowing.