Some railway operation activities is closed to private sector investment. Those that are open, there are no restrictions on foreign participation. Transactions involving foreign investors may, however, be subject to national security screening.
"CHAPTER 3: GENERAL CONDITIONS ON FDI [...]
3.4   ENTRY ROUTES FOR INVESTMENT 3.4.1 Investments can be made by non-residents in the equity shares/fully, compulsorily and mandatorily convertible debentures/fully, compulsorily and mandatorily convertible preference shares of an Indian company, through the Automatic Route or the Government Route. Under the Automatic Route, the non-resident investor or the Indian company does not require any approval from Government of India for the investment. Under the Government Route, prior approval of the Government of India is required. Proposals for foreign investment under Government Route, are considered by respective Administrative Ministry/Department. 
[...]
3.5   CAPS ON INVESTMENTS
3.5.1 Investments can be made by person resident outside India in the capital of a resident entity only to the extent of the percentage of the total capital as specified in the FDI policy. The caps in various sector(s) are detailed in Chapter 5 of this Circular. 
3.6   ENTRY CONDITIONS ON INVESTMENT
3.6.1 Investments by non-residents can be permitted in the capital of a resident entity in certain sectors/activity with entry conditions. Such conditions may include norms for minimum capitalization, lock-in period, etc. The entry conditions in various sectors/activities are detailed in Chapter 5 of this Circular.
[...]
5.1 PROHIBITED SECTORS
FDI is prohibited in: [...]
h) Activities/sectors not open to private sector investment e.g.(I) Atomic Energy and (II) Railway operations (other than permitted activities mentioned in para 5.2). 
[...]
5.2 PERMITTED SECTORS
a) In the following sectors/activities, FDI up to the limit indicated against each sector/activity is allowed, subject to applicable laws/regulations; security and other conditionalities. In sectors/activities not listed below, FDI is permitted up to100% on the automatic route, subject to applicable laws/regulations; security and other conditionalities. [...]
c) Foreign investment in sectors under Government approval route resulting in transfer of ownership and/or control of Indian entities from resident Indian citizens to nonresident entities will be subject to Government approval. Foreign investment in sectors under automatic route but with conditionalities, resulting in transfer of ownership and/or control of Indian entities from resident Indian citizens to non-resident entities, will be subject to compliance of such conditionalities. 
[...]
5.2.16 RAILWAY INFRASTRUCTURE 
Sector/Activity | % of Equity/FDI Cap | Entry Route 
Railway Infrastructure Construction, operation and maintenance of the following:  (i) Suburban corridor projects through PPP, (ii)  High speed train projects, (iii) Dedicated freight lines, (iv) Rolling stock including train sets, and locomotives/coaches  manufacturing and maintenance facilities, (v) Railway Electrification, (vi) Signaling systems, (vii) Freight terminals, (viii) Passenger terminals, (ix) Infrastructure in industrial park pertaining to railway line/sidings including electrified railway lines and connectivities  to main railway   line and (x)  Mass Rapid Transport Systems. | % of Equity/FDI Cap: 100% | Entry Route: Automatic
NOTE: (i) Foreign Direct Investment in the abovementioned activities open to private sector participation including FDI is subject to sectoral guidelines of Ministry of Railways. (ii)Proposals involving FDI beyond 49% in sensitive areas from security point of view, will be brought by the Ministry of Railways before the Cabinet Committee on Security (CCS) for consideration on a case to case basis. [...]" (Government of India/Ministry of Commerce and Industry (2020), Consolidated FDI Policy (Effective from October 15, 2020))
Government of India/Ministry of Commerce and Industry (2020), Consolidated FDI Policy (Effective from October 15, 2020)
[<a href="https://dpiit.gov.in/sites/default/files/FDI-PolicyCircular-2020-29October2020_0.pdf">Policy</a>]