The quantity of imperfect produce that never makes it to market is staggering. This is a huge opportunity for enterprising individuals who are able to recognize how much money can be made by simply identifying useful sources of waste. Nevertheless, the nuances of your question imply much more than the the basic economic aspects of the equation, even though you approach it with your purchasing power in mind.
First of all, take into consideration that most commercial farmers will not spend any money to harvest, wash, pack, and transport something they can't sell. It simply rots. Of course there are a few farmers who will spend their time and money to make sure it goes to food pantries, and a very different set of farmers who will try to utilize that waste for livestock feed, but your requirements regarding the true nature of the food you intend to buy is much more significant than the intentions of the farmer, even though he is often ultimately the source. It seems you want to purchase food that is environmentally friendly. Kudos.
Your question indicates your concern for what would happen to this food if you didn't buy it. Think first about what happens when you do buy it. By providing a market for that which is unmarketable you are essentially rescuing that product from the worm. It gets collected only because you exist and are willing to pay the cost of collecting it. That rescue operation has cascading benefits you approve of, but you are not in any way in competition with them. In fact, your purchase is making the surplus from your food buying activities available to the food pantries and hog farms. When you buy this food you are paying to have what you don't buy sent to the other destinations that would have otherwise received nothing. In this way, the positive ecological effect of your purchase is probably much greater than you realize.
The environmental impact of producing anything will generally increase in proportion to the waste, but this is not always the case with agriculture. Some methods of producing food will not yield anything marketable whatsoever, but will yield a product which is vastly superior to anything commercial farming can offer.
A couple weeks ago I cropped the most spectacular nectarines you could possibly imagine. I kid you not, I brushed off Chinese beetles from half devoured fruit that were being inundated by insects, insects who knew which ones were the most delicious, just so I could partake in the orgy of sweet flesh that nature provides. Beautiful looking supermarket nectarines at $1.99 a pound were utterly disgusting in comparison.
I don't spray. I won't spray. Total chemical fertilizers I use equals zero. Today, while I let the water run on those particular fruit trees, I carved out a water catchment in fertile soil that will harvest 20 times as much rainfall every time it rains heavily using nothing more than a shovel and a pick. This is not how most commercial farmers produce their fruit. This closely resembles subsistence agriculture and it's very sustainable, but it is probably not even remotely similar to the actual source of the food you are considering buying. It would be much better if you examined something closer at hand.
Short answer = Yes. Buy that food. You might find it to be better. You might even discover that the environmental impact is very close to zero, or better than zero, even after you factor in the transportation costs. More importantly, you should consider how and where that food was made. If the reason it is substandard is because it is the product of a superior method, then I'm rooting for you even more.
For instance, it is well known that organic vegetables may have spots or insect bites taken out of them. It is also understood that many types of food are not available in the supermarket because they would not be adequately "presentable"
after shipping, handling, ripening, or packing operations. If these are the reasons why the produce you want to buy has not made it to the supermarket, then consider yourself fortunate to have access to it.
Now would be the perfect time to mention that the greatest chefs (IMHO) on Earth, will only purchase and use apricots that have been pecked by birds. This holds true for many types of fruit. I eat my own fruit and realize why this is so. How are these chefs able to find such a product? They must be intimately familiar with the source. Such a thing is not likely to be found at Walmart. The primary key for anyone who honestly wishes to be environmentally friendly is that you need to be intimate with the source.
The three sites you listed do not mention the possibility that their product might actually be better. Perhaps it is not. If your goal is to reduce large scale waste, then that is admirable and you should proceed with these companies because that will surely be the outcome. The company called "Full Harvest" doesn't brag about donating to hungry folks, so I assume that this is not one of their concerns. You should consider that if you are inclined to promote proper nutrition for the disadvantaged. Personally, I would choose none of the above. Get with those near you who need your support.
I'm just an old fool, stuck in my (economically stupid) ways, looking for better ways. I'm answering this question because I think you have the right intentions. I'm hoping others will be as conscious of their decisions as you are and I want to help inform them. I'm proposing that there are many better ways that are often not readily apparent.
I asked everyone I know if they would be willing to help me harvest apricots, plums, peaches and nectarines that they would be free to take home or sell as they wish. No takers. No one even asked to taste them. I'm left to assume they prefer the crap in the store. Perhaps it's just a bit easier? It's sad when we fail to recognize our alternatives when they are available.
You mentioned a "local farm" that has apples. The simple fact that you are close enough to a local farm that has apples is evidence to me that local produce is an option. This is what you must explore. Perhaps helping that farmer sort out the apples he cannot sell is a service you can provide for him. He will most likely let you take any that are not fit for market. You can feed them to the pigs. You can drop them off at the food bank. You can make applesauce or cider. It's a wasted resource, and if you want to sell them online, as some have done, then that is certainly a respectable livelihood. Supporting those who have a respectable livelihood is the next best thing to having one of your own.