This is a popular song among masochists. In reality it’s not at all about S&M.
According to John Mellancamp, he wrote this song as joke. In an interview he explained: “My friend George said, why didn’t I write a song with the title ‘Hurt So Good’? We thought of it as like a Shel Silverstein thing. I wrote it in three minutes, scrawled the first line in soap on the glass door in the shower.