An arapaima kept in a too-small tank will suffer one of three fates: it'll stunt until it dies, it'll be killed for growing too large, or it'll be released. The first guarantees a bad death, the second might be, and the third will probably not end well for either the fish or the environment it's released into. Theoretically someone could find out that their fish will need a pond and will build one for it, but that really just doesn't seem likely.
An arapaima grown for food will be kept in a pen of some sort that will probably be crowded but will be fairly large, it will be kept healthy enough to grow to a fairly large size, and it will then be killed fairly quickly. That means it'll probably live longer than an aquarium arapaima, it'll have more space, and its death will probably be more humane.
I wouldn't say the ones raised for aquariums are anywhere near 'lucky'.
Farm raised fish would generally be killed off at about a year old or 3' in most cases.
P pharmaecopia dont take this personally, but you just highlighted my exact points why its not a great idea to stock them in an LFS without being special order, which is people will impulse buy these large fish without much 2nd thought if they are cheap enough...
The same can be said of this hobby in general. Most people don't research any purchases ahead of time, monster or not. I know in my area if I go on a shopping trip I'll come across tons of arowanas, large growing pims, stingrays, alligator gars, peacock bass, id sharks, giant gouramis and generally a couple lungfish. The reason for this is because there is the demand for these species in the hobby. If there wasn't these would be brought in.