There is a known rule that Rishonim cannot argue on the Gemara when it comes to "Halachic" drashos. For example, a Rishon will never give a different answer to a question which the Gemara already answered (Tosfos may ask why the Gemara didn't give that other answer, but he will never give his own answer without more). This is true whether the Gemara's subject is practical Halacha or not.
However, when it comes to aggadic drashos on Tanach, we find Rishonim "disagreeing" with Midrashim and late Acharonim disagreeing on Rishonim. Why do Rishonim feel freer to disagree on an explanation of Chumash than to disagree with a Gemara?