I would say you were being a jerk. Textbooks can be expensive, and university students often don't have a lot of extra money to spare. Basically, by cornering the market for textbooks for that class and selling them for way more than you paid for them, you were screwing close to 50 people out of money that could have gone towards something else they needed, or even something they wanted to spend money on if they didn't have to spend it on textbooks. I'm sure a lot of these people could afford it, but I can guarantee that some of them could have really used an extra eighty bucks lying around.
Now, if you were selling them for say, $10 profit a book, this would be an entirely different story. Not only would you still be making a bunch of money (relative to how much time and effort this probably took), but you would actually be helping people by offering a cheaper alternative to the ridiculously overpriced textbook market.
But basically, a good ethical rule of thumb is that if you're making a massive return on a risk-free investment, there most likely is something unethical or illegal about it.
As for the doing anything illegal, I would say probably not. The main thing that you might get in some sort of trouble for is emailing everybody in your class about it, depending on your schools policies and if you were actually using your university email to do it. I know my university has a strict policy about using your school email for for-profit ventures, and I would guess that it is a fairly common policy. Basically, be prepared for some sort of consequence, especially if word gets out about it.