You need to wrap the conditions in parentheses:
when((col("salary") >= 400000) & (col("salary") <= 500000), lit("100"))
Otherwise your condition will be interpreted as below, due to operator precedence - & is higher than >=.
col("salary") >= (400000 & col("salary")) <= 500000
which does not make sense and gives the error you got.