It’s often given with other painkillers, such as with paracetamol in co-codamol, because codeine doesn’t actually act at the site of the pain and so can be combined with others that do.