Transformation of optimal control problems with a state constraint avoiding interior boundary conditions