a friend asked me if a 125 amp sub panel would be ok for three water heaters that are 40 amps each.
Is the 40 amps the actual heater current, or the individual circuit ratings?
individual circuit ratings
Really comes down to the application.
If you're talking about water heaters used as household ones are....heating separate systems, and used occasionally for brief periods, the 125 amp panel should be fine.
If these are used together, as in supplying hot water to a production process, and use continuously, than you have to treat the loads as continuous, and have that 25% "buffer' added in to both your panel and the wire supplying it.
(Use the KW ratings of the heaters for your calcs).
At max proper circuit loading, which would be (40a. x 80%) 32a. each, that's 96 a. total.
Another way, 3 x 40a. = 120a. Either way, you're okay.