Thank you for playing :)
The formula for getting / losing coins is
win = 2 * boxes_count * similarity - 20
It’s possible to get between +20 and -20 coins with that, and it encourages the user to do some warehouse management and sort boxes by color. The -20 is chosen in a way the player is required to do some sorting to win, making good use of space he got available.
Thanks for your feedback, I appreciate :)