If you're asking whether this will be seen as ethical by a university administration, the answer is no. The law probably lines up with the ethics that fall into the professional norms of the university admin.
The money that the public pays for textbooks does not flow into the pockets of the people that generated or summarized that knowledge, so the system is far from fair.
I had a professor who actually told us to download his book illegally if we could get it, and when we pointed out he was the author, he said he made negligible returns on the sale.
Which gets us to the professional norms of your field. Some fields are big supporters of free access to knowledge. In these fields, the arxiv and scihub are popular. Downloading anything illegally if it's academic knowledge would generally be accepted as ethical within the professional norms of those fields.
Personally, I believe academic knowledge should be much freer than it is, and everyone should have access to the work we do. I'm not studying physics because I want to get rich. I study this because it's beautiful and it's important, and because these are fundamental questions for humanity, and answers should be shared with humanity. We all benefit from living in a society that's informed about itself and the world around it.