The peak of the volcano is measured at 4000m above sea level and two streams of lava and molten rock flows down the side facing East and West. Two villages facing the North and South of the volcano wants to trade with each other, they decided to construct railway track connecting both side so that a train can ferry people and goods to and fro. They noticed that they cannot built the track around the volcano due to the flowing lava and neither can they tunnel through it, using 18th century technology how can a train be able to move between two villages safely and effectively? answer with the fastest and safest route wins.
Build a high wall from boulders and debris that effectively dams one of the lava streams. As the lava rushing against the wall solidifies it will only strengthen the wall further. Then you can build a railway around the foot of the volcano in complete safety.
Disclaimer: Neither of these fully follow the "Can't tunnel, and can't build around" as outlined in the question. I do think the follow the spirit of the question, though.
One option would be to build the track far enough out of the way that the lava flow would have cooled and solidified before it reaches the track
Pros: Generally safe, relatively simple to build
Cons: Slow travel, vulnerable to increases in lava flow rate.
Another would be to build a bridge over the lava flow. Ideally there would be a point at which one of the lava flows is narrow enough for a single bridge span to cross it.
Pros: Much faster. Not inherently unsafe. If the builders happen to have some material with a higher melting temperature than the temperature of the lava, a bridge could possibly be built right through the lava flow.
Cons: Difficult to build, depending on what materials are available. Also vulnerable to increases in lava flow (If flow level rises and starts melting the bridge's end supports)
A bridge is the best option in my opinion.
You would be a lot faster than surrounding it. Also it needs much more lava to reach your bridge than to reach a railway which counted on the distance between the volcano and the railway, because there would be lava needed to fill the whole place until it's reaching your bridge. I made a sketch but i have no clue how to upload it.
There would be a lot of heat at the bridge. You could cool the bridge with water and use the produced steam for a steam powered locomotive on your railway.
The problem is not the melting temperature of the material the bridge is build of but much more the factor with which the Material expands under rise of temperature. Also the loose of stability under heat would be a problem which was solved in the seventies of the 19th century. Which is too late for your question.
There are a few concepts which allow to build a bridge without pylons. What would be needed because on the pylons the flow of the lava would be stopped and direct contact to the lava would boost the transmission of heat and in the worst-case the lava would cumulate there to build a lava-bridge to your bridge. Also a catastrophic scenario would be if those streams would grow to get in directions of north and south. But to make a railway which is secure against this would be way out of the cost benefit analysis.
You might have a similar result with the bridge cooled with water like making a fried egg in carton. The egg boils -> (your water which produces energy) and the carton -> (your bridge) doesn't burn because you cool it with the egg -> water.
But that brings me away from the main topic.
As you said noting about the financial requirements of the railway I assume you have a realistic amount of money, as much money as two villages are willing to spend on a railway.
- A bridge without pylons at a reasonable height above the lava stream.
- Power-production for your railway included into the bridge.
The bridge would be the second fastest way after a tunnel which is not buildable. The bridge is safer cause more Lava is needed to damage it than a railway with a great distance to the volcano. The bridge produces energy and will be amortized much faster than a bridge which does not.
The construction of the bridge will be a bit dangerous in comparison with the other way. But that could be done by prisoners so no one cares if they die (Ingenious 18th century tactics)
Answer: this is impossible. You state to use 18th century technology. The first modern steam locomotive was George Stephenson's Rocket built in 1827; well into the 19th century. It could pull a few (less than 10) cars as seen here up to a maximum speed of 28MPH. A replica can be seen in the picture below.
If you wanted to use 18th century tech, the "train" would be pulled by horses, and no 18th century material would hold up to lava indefinitely. The 2nd industrial revolution (ie where we learned to deal with metals/alloys on a large scale) didn't start until 1850. My recommendation is you need to shift your timeline forward to the 19th century, as none of the things you need existed in the given period.