This is a slightly more serious answer than the rest; apologies in advance. :-)
In the question you quoted a particular problem from Bhaskara's Lilavati, but it should be noted that all the problems in Lilavati, as well as all their solutions, and all the theorems, and all the algorithms, are also in the form of metrical poetry.
In fact, this is true of much of mathematics done in India for many centuries. There were many reasons: The tradition preferred oral transmission to written, and verse is easier to remember. Also, the tradition valued having things in your head over merely knowing where to look it up — and again, for keeping something in your head without relying on external references, verse is better. Etc. So these, at least, are reasons for storing (some) mathematics as poems.
For instance, I noted recently another problem from the Lilavati, which is in the enchanting mandākrānta metre of Sanskrit:
In a lake swarming with geese and cranes,
the tip of a bud of lotus was seen one span above the water.
Assaulted by the wind, it moved slowly,
and was submerged at a distance of two cubits.
O mathematician, find quickly the depth of the water.
(Yeah, you'll have to take my word that it sounds more beautiful in Sanskrit!)
(One cubit = 2 spans; this is just a quadratic equation.)
Outside the Indian tradition, one famous example that comes to mind is that when Tartaglia first came up with the method of solving a cubic equation, he left it at Cardano's house in the form of a poem (see here for translation and background):
Quando chel cubo con le cose appresso
Se agguaglia à qualche numero discreto
Trouan dui altri differenti in esso.
Dapoi terrai questo per consueto
Che'llor produtto sempre sia eguale
Alterzo cubo delle cose neto,
El residuo poi suo generale
Delli lor lati cubi ben sottratti
Varra la tua cosa principale.