Etymology
Today it means: To ridicule, to make fun of (someone). Full definition →
Compare rag (“to tease, torment”).
Etymology from Wiktionary, CC BY-SA 4.0.