What really happens is that the gene pool becomes filled with genes that influence bodies in such a way that they behave 'as if' they made complex, if unconscious, cost/benefit calculations
The Selfish Gene: 40th Anniversary Edition (ed. Oxford University Press, 2016) - ISBN: 9780198788607