Tonight my wife told my family about a story she read around 1982, probably written earlier, about a group of children in a room who must pull levers and perform other tasks to be fed. One group of children refuses to participate, then all are transported back to the normal world, where the ones who conformed remain programmed, the ones who did not are free.
This is likely William Sleator's 1974 House of Stairs.
One by one, five sixteen-year-old orphans are brought to a strange building. It is not a prison, not a hospital; it has no walls, no ceiling, no floor. Nothing but endless flights of stairs leading nowhere, except back to a strange red machine. The five must learn to love the machine and let it rule their lives. But will they let it kill their souls?
They at first have to push buttons and pull levers to get the food. Later, they have to do a sort of a dance to get the food when the lights blink. Then they find that the food starts to become dependent on them being cruel to each other. Eventually, it's proven to be a government experiment in operant conditioning to provide soldiers who will always follow their orders. There's also a memorable bit at the end where, after being released, they see a red traffic light and feel compelled to dance.
I read this book as a child, and was fascinated by it, especially after reading my mother's psychology textbooks.