I made an iron farm and started trading iron for emeralds with a toolsmith. Once it got to master, the price of iron increased from 4 to 6 iron per emerald while the rest of most of the trades went down by 2 per item. I started off by buying stone axes and once its skill increased I started selling the iron.
This ticket is a duplicate of MC-146373, which was later resolved as, "Works As Intended". What you are experiencing here, is the villager's "supply & demand" feature. Basically, when you purchase a lot of the same item, the villager will charge more for it and this is completely intentional. Please see the parent ticket for further details.