English usage in conditionals is confusing. There is no separate form for the subjunctive, so we have to express it using an uncongugated past tense. This minor distinction is most clear with the conditional form of "to be", which is "If I were..." not, "If I was..." (a common mistake).
Generally, as Wheelocks tells you, we express a present contrary-to-fact condition with the past progressive ("were ...ing"), which has the advantage of making the conditional flavor very clear, since we don't normally use this construction otherwise. But for a few verbs (primarily "to have", "to be") this sounds very awkward, so we use a simple past instead. "If the students gave..." would be an equivalent to this, but I agree that "If the students were giving..." would be less ambiguous.
Since the present conditional is expressed using the past tense, the past contrary-to-fact conditional must be expressed with the pluperfect. If the teacher had written a mixed conditional, the first part would have correctly read "If the students had given..."
(The correct reply to a sentence like this is, of course, to write in Latin:
"Even if the students were rich, they would not give money to the teacher." Or something along those lines.)
IPHIGENIE: Kann uns zum Vaterland die Fremde werden?
ARKAS: Und dir ist fremd das Vaterland geworden.
IPHIGENIE: Das ist's, warum mein blutend Herz nicht heilt.
(Goethe, Iphigenie auf Tauris)