The National Rifle Association lobbied against a rule to prevent most people with disabling mental illnesses from purchasing firearms.