In an appearance on US chat programme the Late Show with David Letterman, the 49-year-old said: 'At my mum and dad's funeral we made jokes... At my mum's funeral we went along, obviously I thought I should be there.'
He explained how as the vicar was doing a speech, all his relatives, including his sister, started crying and he kindly passed out tissues.
The Office star said: 'I'm a chivalrous sort of guy and I sort of handed them out and soon amongst the crying there were giggles.
'I'd written something on each tissue, things like 'sniveling b****,' things like 'you snotty pig.''
The comedian added: '[The vicar's] thinking, 'I've never got laughs before.''
But Ricky didn't stop there winding up the vicar.
He said: 'I remember the vicar said to my brother, 'What was your mother like?' and my brother went, 'She was a keen racist,' and the vicar said, 'Oh I can't say that,' and so my brother went, 'Put she liked gardening then.''
They even gave the poor vicar the wrong names of her children, Ricky, Robert, Marsha and Larry, so they would laugh.
The vicar said: 'She leaves behind four devoted children, Ricky, Robert, Marsha and of course Barry!'