The quote "Use every man after his desert, and who should 'scape whipping?" is from William Shakespeare's Hamlet, Act 2, Scene 2.
Spoken by Hamlet to Polonius while feigning madness. Polonius offers to treat the visiting actors well; Hamlet replies:
Hamlet: "Use every man after his desert, and who should 'scape whipping? Use them after your own honour and dignity: the less they deserve, the more merit is in your bounty."
If everyone got exactly what they deserved ("desert"), all would be punished ("whipping"). True nobility treats people better than they deserve.
Often mistakenly attributed to Twelfth Night. The word "desert" here means "what one deserves" (from Old French deservir), not "dessert" (sweet) or "desert" (abandon/arid land).