This is perfectly fine. The idea they implied that they borrowed 20 the other way around is the joke. But that’s not the case. We used to solve debt among friends this exact way when kids.
In this sketch they are using Partita Doppia (double entry) to verify those IOU to resolve to 10. There’s not even any fractional reserve, they did not apply interest while lending.
It’s so good of a collection of banking transactions it could fit in Islam too.