In return for his warm hospitality, Silenus, the god of the forest, and Dionysus, the god of wine, promised to realize any wish he had. The greedy Midas demanded that everything he touched be turned into gold, but he soon arrived and regretted it, because even his food and water and even his daughter were turned into gold. Under the guidance of Dionysus, the god of wine, Midas was freed after bathing in the River in Pacteau. It is said that the sand in this river later contained gold.
However, as far as this poem of Borges is concerned, I don't think he used allusions. I think this is just a metaphor. Borges has read so many books that he is almost blind. Even a librarian can only leave thousands of books in the library empty. Just like a rich king, he can only starve, which shows his desire for books and his helplessness in this situation.