I wouldn't say that the lecturers research ability is totally irrelevant to an undergraduate degree. For example, for one of my courses we built up theory to prove a theorem over the course of many weeks. A few weeks later the lecturer told us that a new paper had been published with an elementary proof of this theorem- then we were shown this new proof. If the lecturer weren't working in the field then they would be less likely to see that new proof. Similarly, a different third year course has some theorems that are dated 2009, so some very recent maths. Again, if the university did less research you'd be less likely to see that in an undergraduate degree.
A final example is a fourth year course. The module changed between years because the department wanted to run a seminar related to part of that module.
For incoming undergraduates it's a bit pointless to distinguish between those universities based on RAE though : they're all good at some research areas and weaker at others and people will have no idea of what they're interested in before university.