Two ways: During your first encounter with Tinker Tom or as a possible drop from an unnamed Railroad agent during Tactical Thinking.  To get it from your first encounter with Tinker Tom, you'll need to be at least level 17 and have rank 3 of the Pickpocket perk. An unnamed Railroad agent will be testing the prototype railway rifle at the firing range. If you have rank 3 of the Pickpocket perk, you can swipe it off him. He only has it on him during this event and it disappears from the game afterwards.  The prototype railway rifle is almost entirely useless as it deals close to no damage. Unless you're a rare item collector, don't bother.