When you derive an encryption key from a password, and perhaps a salt, the encryption key is indeed a deterministic function of the password and salt, $k = H(\mathit{password}, \mathit{salt})$.
Presumably the adversary does not know the password, so although the derivation is deterministic, the adversary is about as uncertain about what the key is as they are uncertain about what the password is: at best, they know a probability distribution on possible keys, determined by the salt and the probability distribution on possible passwords.
As you noted, the use of a salt per encryption key prevents the adversary from sharing effort when attacking many targets at once, e.g. with Oechslin's rainbow tables, which traditionally trade memory and communication to reduce hash evaluations at about the same net cost, but which can be parallelized to get an answer faster at substantially lower net cost.
The cost of an attack is measured in storage, computation, communication, number of times we must evaluate $H$, and cost of each evaluation of $H$.
One definition for the ‘security level’ of a cryptosystem in bits is the exponent of 2 in the expected cost of an attack on a single key, by which metric AES-128 has about a 128-bit security level because it costs an expected $2^{127}$ evaluations of AES-128 to break a single key. Another more realistic definition is the exponent of 2 in the expected cost of an attack on all plausible numbers of target keys, by which metric AES-128 should not be considered to have a 128-bit security level.
For a password hashing scheme, the expected cost of an attack depends on the probability distribution on passwords. If they are chosen uniformly at random from $2^t$ possibilities, and each one has a unique salt so that Oechslin's rainbow tables don't help to save work, then breaking the first of $n$ keys with probability $p$ costs about $2^t p$ evaluations of $H$ along with negligible storage, communication, and other computation costs.
If you picked passwords uniformly at random from $2^{128}$ possibilities, then this would be the end of the story, and any old preimage-resistant hash function like MD5 would work just fine: the number of MD5 evaluations is so high that any attack on any number of targets is infeasible. But humans don't pick passwords like that, unless they ask for computer assistance like they should but invariably don't, in addition to their various other basic flaws like inability to fly.
So password-based key derivation functions also raise the cost of evaluating $H$, such as by iterating a fast hash function such as SHA-256 with no shortcuts, and by using as much memory as you're willing to devote to it, as scrypt and argon2 do. If the cost of evaluating $H$ is $2^c$ times the cost of evaluating some basic hash function $H_0$, then in estimates of attack cost with factor $2^t 2^c p$ for probability $p$, using $H$ is as if the passwords were chosen uniformly at random from $2^{t + c}$ possibilities and hashed with $H_0$.