As @rcarnell explains, MLE (maximum likelihood estimation) is optimising on the training set.
I would add that it has traditionally been performed on purposely low complexity models (eg simple low parameter linear models), and so are not at risk of overfitting.
Machine Learning uses models with very many parameters, for which overfitting is an issue. In this case regularised regression (eg L2 regularisation/weight decay/stopped training) will perform better than unregularised MLE for predicting new samples (generalisation)
Intuitively I prefer loss functions that are a sum of an error term and a complexity term. Focal loss is a mix of these hoping to optimise test NLL (or perhaps rather accuracy and calibration), in much the same way as regularised regression does (by not optimising just training set negative log likelihood, NLL). In the paper Calibrating Deep Neural Networks using Focal Loss they suggest focal loss is an upper bound of such an additive loss:( NLL - $\gamma$ entropy(predictions)) [we want to minimise NLL and maximise entropy].
As mentioned in that paper,
The promising performance of weight decay Guo et al., 2017
(regulating the norm of weights) on the calibration of neural networks can perhaps be explained
using this. This increase in the network’s confidence during training is one of the key causes of miscalibration.
You have this generalisation problem even in simple logistic regression, in particular, you can view 'perfect separation', where MLE on small amounts of data causes the weights to 'blow up' and the probability estimates to go to 0/1 as an overfitting problem. The standard solution there is to use regularised logistic regression (eg L2, which is equivalent to weight decay). Infact in the calibrating deep neural networks paper, they show that focal loss also works for this case in Appendix C.
In Guo et al., 2017 they point out that weight decay has gone out of fashion, despite the fact that it seems to help calibration error. Whilst I could see it's not so helpful for all the relu hidden layers, it would seem to be beneficial for the sigmoid output layer.