As I've told Wikipedia, the earliest printing of the song appears to have been in "A Garland of New Songs containing...The old ram of Derby [etc.] (Newcastle-on-Tyne?: Angus, Printer, 1790?)."
A "Darby [sic] Ram" tavern," however, was located in Philadelphia by 1785. ( "The Philadelphia Directory," by Francis White [Philadelphia, 1785]).
For all anyone knows, the Derby ram of the Christmas custom was suggested by the song rather than the other way around.
No evidence exists that the custom and/or the song date back to the Stone Age or even to the Renaissance. Lloyd reported that "some say" the ram represents "the Devil himself." Who says so, or why, or when, is a mystery.
There are simply no printed references to the ram before the eighteenth century.
Rams are vital to those who raise sheep. The song may simply be a humorous description about a fancifully huge (and therefore useful and profitable) ram.