Technical solution
I suggest a very simple technical solution: Apple, Samsung etc each create a website where each owner of a phone, tablet etc. can register the serial number of their device and the passcode. Then all the FBI has to do is give Apple or Samsung the serial number, and they’ll get the passcode.
If there is a typo in my passcode or two or ten, that’s obviously not the manufacturer’s fault.