Celebrim
Legend
Ok, so we're using the terms very differently.
Not as differently as you seem to think.
"Loss of agency" would be the GM saying, "No, you wouldn't do that because of (insert reason)..."
Yes, but railroading almost never happens that way. Very rarely is a GM running a railroad so inept at running a railroad that they just start playing your character for you or telling you what your character does. I'm sure it happens, but most railroading employs much more subtle techniques than that.
You say that the dice can't take agency from the player because the player still has full control over the propositions he makes. But you are assuming that the dice are fair and the mechanics are chosen to represent accurately the state of the world. But that doesn't have to be true. I can run a railroad purely by manipulating the probabilities of success, by making progress away from my chosen story goal prohibitively hard while progress toward my chosen story goal is much more likely to succeed. I simply only need tell the player that for everything he wants to do, he fails because what he wants to do is too hard. So in this case, despite the player having the full ability to declare an intention to attack and kill an orc, because the orc is an important NPC to my plot and he's supposed to get away at this time, I need only make his defenses high enough that the PC's intention always fails. And note, in this manner I get as a GM exactly what I want, but I never have to explicitly say "No." I am in fact saying "No.", but I'm pretending that it is simply the way the dice go.
(Which is kinda funny, since most people use "sandbox" and "railroad" as opposite ends of a spectrum, when really you could quite easily have a sandboxy railroad.)
Linear is the opposite of sandbox. Linear tends to imply some sort of agreement by the players to stay on rails, with our without any heavy handed railroading technique. Remember, I'm defining agency as the ability to affect the direction and outcome of the story, and if the story is linear and prewritten then I don't have a lot of agency. I might have enough to enjoy it, or I might not care about agency, or I might actually prefer to play in a linear game for the different payoffs that can have. Note that "railroading" and "a railroad" are subtly different ideas. Railroading is a verb. Railroad is a noun. "A railroad" is simply a dysfunctional linear game where despite the fact the participants don't like the direction the story is going and are trying to change it, they cannot actually change it.
You can engage in railroading in a sandbox. In fact, several railroading techniques are designed to create the illusion of a sandbox - "Small World" for example is a technique of giving the illusion of a sandbox while presenting the players hooks which you know that they are unlikely to turn down so that, despite the fact that they believe that they are making their own choices, you have manipulated them into making very predictable choices. Basically you make all or almost all of the fun only in the direction you want them to go.