I'm thinking this would be a machine, bought in parts and assembled like a block/fuelmaker at your home.
You would 'feed' it items, like donating to a shrine, and like donations this would contribute to a total.
Once that total is reached, you could dispense an item.
The item type could be determined by an assembled part added to the machine, so you'd add a food module to create a random item of food when the total was reached, or a cubimal module to get an unopened cubimal box, and so on. (obviously the total you'd need to reach would be different depending on the type of module loaded).