A giant John Deere tractor and a pocket-size Apple iPhone have something important in common: The cost of repairing either one is too high.

The two companies, and many of their peers, use a variety of aggressive tactics, including electronic locks and restrictive warranties, to push customers with broken equipment to seek help from their authorized repair facilities — or to give up and buy a replacement.

This is unfair to consumers who might be able to obtain, or perform, lower-priced repairs. It’s unfair to independent businesses that might do the work. And it’s bad for the environment, because the high cost of repairs leads people to toss devices that might have been fixed.

Late last month, Senator Elizabeth Warren of Massachusetts, who is running for the Democratic presidential nomination, proposed a national right-to-repair law for farm equipment. The idea is based on a 2012 Massachusetts law that requires carmakers to provide the information necessary to perform repairs and to sell any special tools needed to do the work. The law also phased in a requirement that new cars be compatible with generic diagnostic tools.