It is a contract. A labour agreement between an employer and a group of employees who have every right to democratically agree on some things like pay.
It lays out expectations with responsibilities and ramifications for both sides and provides a stable term once an agreement is made.
It prevents price fixing by an employer in the sense that a lone employee can have their ‘price’ fixed by the employer and their roles ‘fixed’ by the employer with no power to fight back as a lone person against at least a company lawyer. An employee in a union with a collective agreement has counterweight to abuse because they too can pool resources, they too can cause harm to the other side and fight back, and it works - because it’s a contract.