How can the mourners say Kaddish at a funeral, are they not still in the category of an Onein, who does not say any Tefillos, and does not even answer Amein?
Shalom, The reason why an onein, that is someone whose close relative has died but not yet been buried, is exempt from performing the mitzvot is twofold. Firstly it is to ensure that they totally devote themselves to the mitzvah of burying the dead. Secondly, it is out of honor for the dead. According to both of these reasons the mourner should say kaddish at the funeral even before the grave is closed and the onein status ends. According to reason that one needs to devote themselves to the burial - the kaddish is itself a part of the burial service. And according to the reason of giving honor to the dead - saying kaddish also does that. (See Gesher HaChaim 18:2:3). May we all be blessed with long life and good tidings.