Can a public-sector employer ask for information about a prospective employee's previous salary? Can they base their offer to the employee on that information? Can the offer be below the advertised salary range?
Seeing as you haven't given any jurisdiction or any industry, I'll just answer with the common law answer: yes.
An employer is at liberty to ask for any information as long as they are not prevented from doing so by law.
They are entitled to use any information at their disposal to calculate a salary offer.
Employment contracts almost always include an "entire agreement" clause, meaning that the advertised salary means precisely nothing.