I've never taught a course without learning something. The process of teaching forces you to articulate ideas in ways you wouldn't have thought of otherwise. From undergraduate grammar courses I've learned more Spanish grammar and syntax; I developed ideas for my Lorca book out of my translation course. A very basic introductory course on literary analysis led to some ideas about redundancy in poetic language. Teaching literary theory forces me to go back to texts I wouldn't have looked at in many years.
I think I learn more from teaching undergraduate courses, because I often teach things I don't know as well, with the confidence that I can still stay far ahead of my students. You really should learn more from grad students than undergraduates, but that is not always the case.
I imagine it would be different in hard sciences, where basic courses would not teach the professor anything.
Teaching fewer courses would theoretically allow more time for research, but I wouldn't want to teach all that much less than I do. Teaching helps to structure time, allows the research process to be less solitary. As long as I can get a year or a semester off once in a while, I'm fine.
So very soon I have to figure out a course for next fall. It's modern peninsular lit at the undergraduate level, and I can teach any topic I want. What I want to do is teach something I can be completely enthusiastic about, something that I can learn from teaching.