I believe, but am not sure, that there is an exception for the round-trip train excursion where you do not exit the train at all... but I don't know if those go to the border.
That is correct. As it was explained to us when we did this tour: although we would enter Canada by a short distance (it may have been 100 yards) as long as we didn't leave the train Canada didn't consider us as entering their side of the border. Look at is as a friendly "understanding". We were warned that if we did exit the train the railroad was required to notify Canadian authorities and report any violators. Obviously they took this seriously since they didn't want to mess up the agreement.