British spelling of programme and diagram

The form diagramme was found in English. When it was first borrowed into English from French, this was done with people familiar with the French (obviously) and they used it as such.

It is little surprise to find Webster's 1828 dictionary using diagram (and for that matter, epigram rather than epigramme).

Interestingly for oriflamme he has not oriflam but oriflamb, introducing a different silent letter.

This does not mean that Webster was the innovator here, though he might have been: He made some innovations, but also leaned to one side or the other of current differences in spelling.

Now, it's often said that Webster's views on spelling are why some American spellings differ from the British spelling of the same word, but this is only partly true: Some of his spellings were (eventually) adopted throughout the English-speaking world, some were rejected in America, and of those cases where the spelling differs some have nothing to do with him (the rise of -ise over -ize among the British for example).

I can't be conclusive, but I'm going to suggest that Webster had a role either in the shorter spelling or at least in its becoming the more more popular, and programme is an example where his spelling didn't take hold in Britain, while diagram is an example where it did.