He was parked under the rail bridge when police arrived, Mr Camp said.
The incident was reported by a member of the public.
KiwiRail, which owns the line, said no infrastructure was damaged by the incident.
KiwiRail could not comment on why the access gate was unlocked, a spokeswoman said.
But the incident was "taken seriously".
"All incidents are avoidable if people don't take foolish risks," she said.
Dunedin Railways operations manager Grant Craig said the delay to the Taieri Gorge train was minimal.
He declined to comment on the incident as it was up to KiwiRail to "deal with those idiots".
Mr Camp said it was too early to comment on what, if any, charges would be laid against the driver.