The class on "Medieval Music You Already Know" inspired me to do a class on contrafacta in period. I'd done classes in "filk" - which is a more lighthearted word for the same thing. But this was about filk in period - from fourth century Arian adaptations of popular music, through troubadours borrowing church music for their love songs, to composers using folk tunes as the basis for polyphonic masses.
We looked at borrowings as many as four deep, as a twelfth-century "Ave Regina" chant may have been used for a twelfth century troubadour's love song, which was borrowed for a thirteenth-century pilgrim song, and a thirteenth century song in praise of gluttony.
Anyone who thinks of the middle ages as insular or restrictive might be surprised at the international trade in music. A tune that's still popular today can be found in Italian, Bohemian, Gallican, and German manuscripts of the tenth to fifteenth centuries.
Those who prize originality might be surprised to learn that troubadour instruction manuals prefer that older tunes be used for some types of song.
This was a study that was too much for an hour's class. It could easily fill a dissertation (actually, several of them). I recommend the Musical Borrowing Bibliography as a resource. Though many of its 1800+ citations cover modern music, there's plenty on medieval/renaissance works as well.
Shakespeare made fun of the contrafacting of Greensleeves by Mistress Ford's comment about Falstaff:, whose words, "do no more adhere and keep place together than the Hundredth Psalm to the tune of Green Sleeves." (Merry Wives of Windsor II.i.62) She may not approve, but contrafact was a way of life for musicians in period.