Characters in Friends all have arcs and evolve. At the end of the show, all characters are better off than at the start. Joey starts out very poor and by S6E18 is $3400 in debt to Chandler.
In Season 2, Joey gets a glimpse at being financially well off and over-spends. Between S3 and S7, he has to take small jobs to make ends meet. He teaches soap opera acting (S3), tour museum guide (S4), show gladiator (S5) after his "big break" fell through, works as waiter in central perk (S6) before he gets his own show (Mac and C.H.E.E.S.E).
But overall, Joyes situation steadily improves. After Mac and C.H.E.E.S.E is cancelled in S7, In S7E15, Dr. Drake Ramoray comes out of the coma and he keeps this role until the end of the show, making his financial situation much more stable. This can be seen on various occasions, like the one you presented in the question, which takes place in the later half of season 9, where Joey had considerable time to earn money with this rather successful role.
In the end, Joey isn't broke anymore. Hes not rich, but not that poor, either.