The LDS (Mormon Church) sells very inexpensive canned bulk foods, including dried pinto beans and sometimes dried refried beans. Their Apple Slices look ideal for backpacking. They can be mail ordered or picked up in person (which is cheaper).

https://store.lds.org/ProductDisplay...&storeId=10151