NiFe films with a composition gradient are of particular interest from the point of view of fundamental science and practical applications. Such gradient magnetic structures may exhibit unique functional properties useful for sensory applications and beyond. The issue surrounds the anomaly concerning the compositional gradient formed near the substrate in electrolytically deposited binary and ternary iron-containing alloys, which has not previously been clearly explained. In this work, light is shed on this issue, and a clear relationship is found between the structure and surface properties of the substrate, the initially formed NiFe layers and the film composition gradient.