That is not the whole story.
The costs to build the pipeline have to be paid. Once these costs are recaptured, then moving the oil by pipeline is much lower than by rail.
I believe that Keystone costs (when it was cancelled) were over $10B. So it could have been over 10 years or more before shipping costs would go down.
One big advantage to shipping crude oil by rail is that it is more flexible and can respond more easily to changes in supply and demand on a geographic basis. A pipeline from western Canada to the Midwest will move oil from its source to its destination — and that’s it. A railroad that transports oil from western Canada to the Midwest today can change its operation to send it to eastern Canada or the Northeast next week. It would take decades for a pipeline network to be updated to respond to that kind of change.