Copy materials and material indices to instances which aren't copies of anotther object
The Mesh Object Input node have a Material Indices output, you can use that as the input material indices of the Mesh Object Output node as follows:



Alternatively, you can use the following expression to get the material indices:

[p.material_index for p in object.data.polygons]


Where object is your object. To apply modifiers first, you can use the following expression:

object.an.getMesh(bpy.context.depsgraph, True).an.getPolygonMaterialIndices()


As for copying materials themselves, the 2.8 version have a system to set materials to object. But if you are on an older version, you will have to use a python script. Something like this should work:

target.data.materials.clear()
for material in source.data.materials:
    target.data.materials.append(material)


Where source and target are you source and target objects.