Any person electing to come within this chapter who elects to secure credit for prior service as a county peace officer under this chapter, if he has to his credit in any other pension system a sum exceeding that necessary to entitle him to credit for such prior service, shall have refunded to him only the amount by which his credit in the other pension system exceeds that necessary to entitle him to the credit claimed for prior service.