This is the so-called placebo effect, which, far from being imaginary, is a genuine physiological event. The medication may be inert, but the brain is soothed by its own painkillers, the endorphins.
I didn't know that's how the placebo effect worked! Very interesting.