Railways were both a bubble and, eventually, one of the most significant technological innovations in history.