Professional hosting will probably not see a significant difference in price from one platform to the next (at least when comparing .NET, JEE, php, etc.).
The cost of databases, qualified technicians, hardware infrastructure, etc. far outweigh that of the operating system and possible application server licenses you'd have to cover.
That said, php and rails probably appear cheaper than .NET and JEE in particular (I've not seen many hosting providers offering other services like Python) because there are many more in that market segment offering lowcost, low service, packages.
Lower uptime guarantees, lower bandwidth, etc. as compared to JEE especially which is usually targeted at higher end customers.
Think of php being offered to the neighbourhood DIY store when Home Depot chooses JEE because they want 24/7 availability and expect a far larger number of visitors.
Of course that package will be a lot more costly, but you get what you pay for.
It's probably possible to develop the same package using php (never tried, I'm a fulltime JEE developer working on large corporate and (semi)government applications) and the final cost of hosting it would be pretty much the same (especially if you chose to use the same RDBMS as a backend, rather than phps default mySQL whereas JEE projects tend to drift towards Oracle and other highend offerings, but even with that difference that's not a major factor in the running cost which is determined mostly by the hardware architecture of the hosting provider, network usage, etc. (if we assume similar number of support calls due to application bugs/feature requests, etc.)).