The story
Ellipsis of I'll tell you what or I tell you what. The sense introducing an arrangement also corresponds to another, longer established collocation of I'll tell you what I'm gonna do or let me tell you what I'm gonna do.
Etymology from Wiktionary, CC BY-SA 4.0.