Slots have a prize fund, each slot quantifies the money payed in and pays out based on that. This is done using complex RNG algorithms.
It continueasly updates itself so its constantly randomly giving out prizes without bankrupting the providers and keeping inline with the games RTP.
It would be illegal for the slot to have a memory based on what you have put in and out etc, as that would take away the gambling element, gambling has to be random due to a series of events.
In slots the events are done through RNGs