We study the effect of non-Markovianity in the charging process of an open-system quantum battery. We employ a collisional model framework, where the environment is described by a discrete set of ancillary systems and memory effects in the dynamics can be introduced by allowing these ancillas to interact. We study in detail the behaviour of the steady-state ergotropy and the impact of the information backflow to the system on the different features characterizing the charging process. Remarkably, we find that there is a maximum value of the ergotropy achievable: this value can be obtained either in the presence of memoryless environment, but only in the large-loss limit, as derived in [D. Farina et al., Phys. Rev. B 99, 035421 (2019)], or in the presence of an environment with memory also beyond the large-loss limit. In general, we show that the presence of an environment with memory allows us to generate steady-state ergotropy near to its maximum value for a much larger region in the parameter space and thus potentially in a shorter time. Relying on the geometrical measure of non-Markovianity, we show that in both the cases of an environment with and without memory the ergotropy maximum is obtained when the non-Markovianity of the dynamics of the battery is zero, possibly as the result of a non-trivial interplay between the memory effects induced by, respectively, the environment and the charger connected to the battery.