Found the solution (credits). For skeletal meshes the required code is more complex:
USkeletalMeshComponent * SkeletalMesh /*= ...*/;
FMaskFilter Mask /*= ...*/;
SkeletalMesh->SetMaskFilterOnBodyInstance(Mask);
if (UPhysicsAsset* PA = SkeletalMesh->GetPhysicsAsset())
{
for (USkeletalBodySetup * SBS : PA->SkeletalBodySetups)
{
SBS->DefaultInstance.SetMaskFilter(Mask);
}
}