These matters are highly dependent on legislation. I answer for germany.
I put this exact question some years ago to my employer, a German federal research institute and
was told officially to keep the refund since it is basically damages for the additional inconvenience I had.
(I may say that although edge cases can be constructed where the compensation is substantial, in many cases the amount we're talking about is less than what an employer pays (gross) for an hour at minimum wage.)
This is also important in the sense that it gave me the free choice whether to put in the time and hassle for refund burocracy or not.
If the refund were the employer's, it would be up to them to decide whether to claim the refund or not. Just like you have to follow their policy as to whether you go for a cheaper fixed-connection ticket or a flexible one.
this is based on EU legislation wrt. passenger rights (https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=LEGISSUM:l24003), and
here's a German language document by the German Federal administration explaining the reasoning in more detail
To sum this up, the boundary is: compensation for personal inconvenience, e.g. the inconvenience that the total travel time was much longer than planned, goes to the passenger. The same applies for cold water when the train's air condition doesn't work in summer or hot coffee if the heating is off in winter.
However, if the ticket or part of it is canceled (which cannot be done unilaterally by the railway), then this is a reimbursement on the ticket price which goes to the employer.
(And, as always, no double reimbursement. E.g., if OP had to stay over night in some town on their way, the railway has to pay for the hotel, and OP cannot ask their employer for that money.)
This post indicates that to some extent, a policy can be agreed upon in the working contract. However, that is limited only to "ordinary" inconvenience, compensation for "extraordinary" inconvenience always goes to the employee (who was subjected to that inconvenience). If there is no such agreement, it is a compensation for OP's additional inconvenience and thus goes to OP.
Ethically speaking, there is no obligation to disclose facts to one's employer that are not their business. In this case, that would be whether OP applied for compensation or not, and what follows from the application.
OP anyways (always) needs to disclose the actual travel times and anything that is relevant for correct treatment of the travel reimbursement when filing travel reimbursement with their employer, since the additional meal allowance part due to OP depends on total travel time. This is also no decision of the employer, but a consequence of tax law (employer may decide to not or not fully reimburse, but they have to issue at least a statement that allows OP to deduct these travel expenses correctly in their income tax declaration).
Oh, and btw: if you work on the train, that's of course working time. (For readers from other parts of the world: the rules what counts as working time and what doesn't are somewhat complicated, but quite fixed in Germany)
The train being late often means that you could actually put in more time working. So IMHO the question of whether you get paid for the time is not necessarily a very good surrogate for deciding whether the damages for being late would be owed to your employer or not.
The obligation to your employer - if on working time - is to use the delay and work as well as possible under the circumstances. Just as it is if the train is on schedule.