The difficulty of the quest determines what loot appears in the bag. For quests with multiple steps, the difficulty is the sum of the individual steps' difficulties minus any costs (some quests consume difficulty on generation as well as reward difficulty on completion). If this difficulty total is less than 0.5, then a Low-Value Reward is given; if it is between 0.5 and 1.0, then a Medium-Value Reward is given instead. A High-Value Reward is only given if the difficulty total is at least 1.0.
Additionally, if you obtain a Reward Bag from a themed NPC, the loot table for their specific themed chests is also added to the possible drops and you are more likely to get one of these rarer rewards. For example, completing quests from Glitch Castles on Volcanic worlds can reward you with procedurally generated Tier 6 weapons.
Low Value Reward (Net Difficulty < 0.5)
Medium Value Reward (0.5 <= Net Difficulty < 1.0)
|Randomly generated Weapon||40%|
High Value Reward (Net Difficulty >= 1.0)
|Randomly generated Weapon with a better rarity chance||1||10%|