That's why a bunch of companies ask what your previous salary was in interviews and why you need to absolutely not give that number in pretty much all circumstances.
Like I got a 60% bump from my previous salary my last job search, in part because I hadn't gotten raises for several years at my previous company as they had wage freezes, and in part because I had been behind on compensation for a while due to having to take whatever halfway decent jobs I could get while unemployed, but if the prospective employer knew I was getting paid so little, they probably would have significantly lowered the salary they offered to me, and I'd still be behind the market rate for my skills, and the next time I went looking for a job I still wouldn't be offered enough to catch up to what I'm making now. It's a vicious cycle when they know your current salary.