The purpose is to reduce the chance that somebody would be tempted to take an illegal or ill-advised shortcut across the railroad tracks.