Archaic English exclamation of surprise or gratitude, from old French grand merci, great thanks.
And the Cid answered, Gramercy, Sir! God grant you long life and happy, but in your Palaces there is none who should be lodged save you.