By Sanjoy Majumder
BBC News, Delhi
There is a saying that the only way to discover the real India is by taking a train journey.
For decades, many adventurous tourists have used this option - travelling on crowded, non-air conditioned carriages often with wooden seats, at a steady pace through the Indian countryside.
It brought them face-to-face with millions of ordinary Indians who make up the six billion people transported by this vast network every year - middle-class families on vacation, farm or factory workers heading home to their villages, soldiers off to join their colleagues on the frontier.
For years the state-owned system was the ultimate symbol of socialist India - a service subsidised by the state so that the vast lengths of the country could be linked.
While impressive, it was also characterised by poor services, slow trains, filthy stations and archaic signalling systems.
It also never made any money.
Now, remarkably, all that has changed.
Over the past year Indian Railways has generated profits of $4.5bn - double that of India's largest private company, Reliance Industries.
It is also attracting more passengers and improving its services with better trains and improved comforts.
So how has Indian Railways - which is government-owned and operated by a vast bureaucracy - turned things around in a highly competitive market?
I decided to start at the very beginning - at the magnificent and enormous Victoria Terminus in Mumbai (Bombay) - a Gothic architectural masterpiece with lofty domes, carved stone friezes and stained glass windows.
It is a ready reminder that the railways were started when India was a part of the British empire.
This is where, in 1853, 400 people boarded the first ever passenger service in India, from Mumbai to neighbouring Thane - a distance of 34km (about 20 miles).
High-end Shatabdi trains have plush airline-style seating
Now, of course, the railways in India span 60,000km and bridge the enormous diversity of this continent-sized country - from the high Himalayan mountains in the north to the western desert, the western and eastern coasts, the deep south and the distant north-eastern state of Assam.
It is, in effect, India's lifeline.
The vast terminal is teeming with people, as they wait patiently for the first of many of the long-distance expresses to pull in.
Travelling by rail in India has always been relatively inexpensive - a trip from Mumbai to the capital, Delhi, costs between 425 and 3,000 rupees ($10-$73) depending on the class of travel.
But the deregulation of the Indian aviation market has led to a huge increase in budget airlines offering cheaper fares.
So the railways have decided to hit back.
On platform four, a huge crowd is waiting for the fully-air conditioned Garib Rath [Poor-Man's Chariot] to pull in.
Among those waiting are the Ansari family.
Every year, Mumbai shop worker Zahir Ansari takes his family to his village in north India.
But for the first time in their lives, they will be travelling in air-conditioned comfort.
"My wife read about this train in the papers and insisted I try and get us tickets," he says.
"It will be so much more comfortable for the boys in the summer heat," he adds, looking at his two little sons.
The Garib Rath is just one of many initiatives taken by Indian Railways in its effort to attract more passengers.
At the other end of the scale is the Shatabdi Express.
Mr Kumar says the railways are ready to face the competition
This high-speed inter-city train caters to business travellers making the point-to-point journey between Indian cities which are located fairly close to each other - and can be covered in about eight hours or less.
On the Mumbai-Ahmedabad Shatabdi, it is all about living in the fast lane.
As our blue and gold train pulls away, I am seated in an airline-style seat with a footrest, personal reading lamp, a laptop and mobile phone point and a personal LCD television screen to watch the latest stock market trends.
A uniformed attendant pushes a cart through the narrow aisle offering passengers beverages followed by soup and dinner.
The seven-hour journey costs 1,295 rupees ($32).
There are other changes too.
Eating on board has always been a major part of the Indian railway experience.
From piping hot tea served in little ceramic cups to spicy curries and omelette on toast - the railways have always catered to a variety of tastes.
But now, at the modern Mumbai Central station there is a huge sign towering over the concourse - twin golden arches of the world's most famous fast-food brand, McDonalds.
There is also a pizzeria, Starbucks-style coffee shops and Indian fast-food restaurants serving their takeaways in cardboard boxes.
And on board, tea is now made with teabags and served in a little plastic cup.
The railway is India's lifeline
Indian Railways own vast spaces across the country - mostly around their stations.
These will now be rented or leased out to big retail giants - Walmart, local retail brands and hotels.
Considering that the railways have about 7,000 stations across the country, there is plenty of space. It is estimated that 40,000 hectares of railway land is at the moment under-utilised or completely unused.
But to get a real sense of where their ambitions lie, I head out to Mulund - a suburb of Mumbai and home to one of the system's many inland container depots.
This is where huge containers are brought in from Mumbai port to be transported along the railway network to various parts of the country.
"Every half-hour, a container train is setting off somewhere in the country," says Manish Kumar, general manager of the depot.
Recognising that freight can be a major source of revenue in an economy that is one of the fastest growing in the world, the railways have now decided to build dedicated lines for freight trains connecting Delhi with Mumbai and Calcutta.
A senior official at the Railway Ministry, Sudhir Kumar, says the system has been able to turn things around simply by working on their strengths - by improving the infrastructure so that they can carry more loads, people and cargo.
"We are still a public utility and are fully conscious of our social obligations," he says.
"But I feel that there is no inherent conflict between commercial opportunities and social obligation."
So as India continues to transform under its growing economy - some of its oldest and most venerated institutions are beginning to change with clear results.
Even if some of the romance has gone out of one of the world's oldest and largest railway systems.