(abridged) We explore the Frontier Fields cluster MACS J0416.1-2403 at z=0.3972 with VIMOS/VLT spectroscopy from the CLASH-VLT survey covering a region which corresponds to almost three virial radii. We measure fluxes of 5 emission lines of 76 cluster members enabling us to unambiguously derive O/H gas metallicities, and also SFRs from Halpha. For intermediate massses we find a similar distribution of cluster and field galaxies in the MZR and mass vs. sSFR diagrams. Bulge-dominated cluster galaxies have on average lower sSFRs and higher O/Hs compared to their disk-dominated counterparts. We use the location of galaxies in the projected velocity vs. position phase-space to separate our cluster sample into a region of objects accreted longer time ago and a region of recently accreted and infalling galaxies. We find a higher fraction of accreted metal-rich galaxies (63%) compared to the fraction of 28% of metal-rich galaxies in the infalling regions. Intermediate mass galaxies falling into the cluster for the first time are found to be in agreement with predictions of the fundamental metallicity relation. In contrast, for already accreted star-forming galaxies of similar masses, we find on average metallicities higher than predicted by the models. This trend is intensified for accreted cluster galaxies of the lowest mass bin, that display metallicities 2-3 times higher than predicted by models with primordial gas inflow. Environmental effects therefore strongly influence gas regulations and control gas metallicities of log(M/Msun)<10.2 (Salpeter IMF) cluster galaxies. We also investigate chemical evolutionary paths of model galaxies with and without inflow of gas showing that strangulation is needed to explain the higher metallicities of accreted cluster galaxies. Our results favor a strangulation scenario in which gas inflow stops for log(M/Msun)<10.2 galaxies when accreted by the cluster.