1. You can't legally break such code, unless it's for a handful of statutorily or administratively selected purposes
2. You can't legally tell people how to break such code for any purpose
This provision is part of the DMCA, section 1201. It was policy-laundered through the WTO into US law against the objection of the tech community, so basically every country has the same rules.
The problem with this law is that it's scope dramatically extends past it's intent - hell, half the original law is just exceptions intended to control the extremely broad scope of "no breaking digital locks". What people realized was that they could put DRM on anything, regardless of if copyright actually protected it or not, and it would still have the same effect because DMCA 1201 has horrific chilling effects. Even if SCOTUS says you can't use DMCA 1201 to protect, say, printer cartridge DRM; that decision still took 10 years and millions of dollars in legal fees to reach. No company wants to spend that amount of time and money just to gain access to repair aftermarkets.
On the other hand, the law regarding price gouging is very old and well-established; because it's a very long-running problem. Serial-locked parts were basically unheard of outside of videogame consoles up until this decade. The assumption with DMCA 1201 was that it was going to keep people from copying DVDs, not from repairing tractors. It's one of the few cases in which the law actually needs to catch up to technology (as opposed to someone trying to get away with something and parroting a thought-terminating cliche).
Yes, individual Americans will get harmed by, say, anticircumvention law, copyright trolling operations, or automated content ID systems. But nobody gets outraged about that in large enough numbers. They do get outraged, however, when they hear about "China stealing our valuable intellectual property" or somesuch. So the message Congress ultimately hears is, "More please!"
... Federalism?
Most of the time it's not illegal to scalp toilet paper. There are select cities and states, with interventionist city councils and legislatures; when citizens saw inflated prices, these bodies decided that they would enact bans on scalping, in a manner which usually focus on consumer goods.
Note that economists suggest that scalping is a natural part of supply and demand and helps reduce shortages by incentivizing traders to move in supply from elsewhere (and scalping bans are sometimes deliberately weaponized against immigrant-owned small businesses because of course they are why did you doubt for a moment? Even NYC rolled that back somewhat and offered refunds on the fines they levied on bodegas.) But while the theoretical efficiency may or may not actually be realized in the aftermath of a disaster, it is of course entirely irrelevant to the legal monopoly on tractor repair services, which certainly have no such excuse. This just makes it all worse, of course.