Electromagnetic mass differences between baryons in potential models