Villagers use gossip to determine prices
Hitting Villagers or a villages Iron Golem creates
minor_negative gossip and killing villagers or a villages Iron Golem creates
major_negative gossip, raising prices.
Curing Zombie Villagers creates
major_positive gossip and buying from the last trade slot creates
minor_positive gossip, Lowering prices.
Completing raids will lower prices for a certain amount of time and the villagers will give you gifts depending on their profession. (https://minecraft.gamepedia.com/Hero_of_the_Village#Gifts)
Prices will stay raised / lowered until you do something good / bad