Do railroads on a different continent give the production bonus?
If your harbor is connected via railroad to your capital, the harbor connection counts as a railroad. You'll have then to lay railroads from your harbor on the other continent to any inland cities.
In the following example B,C and D would receive the bonus, E would not.
~ ~ ~ ~ ~ ~ ~
|A|============|B|~ ~ ~ ~ ~ ~ ~ ~|C|===========|D|
~ ~ ~ ~ ~ ~ ~ |
`------------|E|
In the next example no city would receive the railroad bonus.
~ ~ ~ ~ ~ ~ ~
|A|------------|B|~ ~ ~ ~ ~ ~ ~ ~|C|===========|D|
~ ~ ~ ~ ~ ~ ~ |
`------------|E|
As DMA57361 pointed out, if the capital has a harbor, any other city with a harbor automatically receives the railroad bonus. In the next example, C and D receive the bonus, E does not.
~ ~ ~ ~ ~ ~ ~
|A|~ ~ ~ ~ ~ ~ ~ ~|C|===========|D|
~ ~ ~ ~ ~ ~ ~ |
`------------|E|
Legend:
A : capital
= : railroad
- : road
~ : ocean