When ammonia evaporates it reduces the temperature of whatever it is in contact with. Metal expands when cold. Usually enough to cause the rust to loosen up. Then the liquid wrench can penetrate the loose rust.