While at Apple, Scott Forstall was in charge of developing the software that runs on iPhones, and he was a close friend of Steve Jobs.

Jobs has a famously deserved reputation as a difficult person to work with, but during an onstage talk at the Computer History Museum on Tuesday, Forstall said Jobs also had a great sense of humor.

Former Apple SVP Scott Forstall. Justin Sullivan/Getty Images Apple is well-known in Silicon Valley for making its employees pay for coffee and food from its cafeterias, in contrast with companies like Google that provide meals for free.

But even though the lunches were inexpensive — about $8, according to Forstall — Jobs, the multibillionaire CEO, still found a way to get around paying for them.

Here's the story in Forstall's words:

"He and I would go to lunch at the cafeteria at Apple all the time, and he would insist on paying. I was like, you're paying me enough that I can afford the $8 lunch, but he'd always — if he got his food before, he'd wait at the line for me to get up there, and he'd pay. And he made it so you could pay with your badge. So you'd come up there and you'd badge in, and it would be directly withdrawn from your paycheck.

"Somehow, I was like, 'Why are you — I mean, like, really, go sit down. I'll be out there. I feel like an ass while you're sitting there waiting for me, and I feel like I can't get any long-cooking food,' and he said, 'No, no, no. This is great. I only get paid $1 a year. I don't know who's paying every time I badge.' He was a multibillionaire scamming Apple!"

This funny little anecdote was only one of several never-before-revealed stories that Forstall told about working at Apple during the Jobs era and the invention of the iPhone.

The entire video is worth watching for any Apple enthusiast. Forstall's interview starts around 1:07:00, and the lunch story is around 1:56:00.