As you said, both codes should work, so that a parameter update in one model does not change the other and vice versa:
modelA = models.resnet18()
modelB = models.resnet18()
modelA.load_state_dict(modelB.state_dict())

# Compare random parameter
print((modelA.fc.weight == modelB.fc.weight).all())
> tensor(True)

# Manipulate param
with torch.no_grad():
    modelA.fc.weight.zero_()

print((modelA.fc.weight == modelB.fc.weight).all())
> tensor(False)