A justice of the peace who knowingly purchases or offers directly or indirectly to purchase any judgment or part of a judgment is guilty of a class 2 misdemeanor.