What the title says. Especially since the empire stopped expanding.
When did the practice of granting farmland to retired soldiers stop? Or did it last until the fall of the empire (what did the Eastern Roman Empire do then?)
I think you're vastly overestimating how densely populated the mediterranean was during the later Roman empire. Although it certainly was one of the comparatively more urbanized areas in the world, the pre-modern mediterranean never even came close to running out of land due to agricultural overuse. What's more, the Romans were not above setting up colonies in places due to primarily strategic considerations, so not all colonies were founded with the intention of rewarding soldiers with good land; for example, Augusta Praetoria Salassorum (modern Aosta, in Italy) was founded prior to the Gallic Wars with the intention of keeping an eye on the crossing over the alps known today as the St. Bernard pass. The Aosta valley is a fine place for a bucolic post-military life, but its inhabitants weren't exactly hauling cartloads of grain down the valley. But to track back to the point about the relative abundance of land at this point in time, in Italy Roman settlements could very well be comfortably founded within a stone's throw of the Socii they were in the process of Romanizing, as in this reconstructed map of Mediolanum while it was still being colonized (the beige spots are modern landmarks, for reference. This rather disappointing map is the best one I could find superimposing Celtic Milan, the gray circle, and the Roman colony, the weird shape in the bottom left, within the confines of the city at its height during the Empire, all superimposed onto the modern street grid. I was certain I had seen a better one but I can't for the life of me find a bookmark or even remember what the page was called).
Although I can only speak anecdotal evidence about the Roman Empire, and know even less about the official policies of Byzantines, I can say that the practice of settling solders with land continued right up to the end of Byzantine involvement in Italy, to the extent that settlement of land even seemed to supplant the salaried military wage system (and that's something I do know a thing or two about!). In fact, in the early politics of the northeast Italian (modern Venetian) lagoons, there is a clear split between conservative and militaristic army families settled in the vicinity of Eraclea, Grado, and Aquileia, and the more self-serving inhabitants of Malamocco, Torcello, and other islands less suited for agriculture and unable to support a warrior-elite. In fact, in the early days of what would be called the Republic of Venice, high society was rather starkly split along three lines: the pro-Byzantine landowners in Eraclea, the pro-Republican merchants of Malamocco, and the pro-Frankish Clergy.
What's interesting is that as Venetian society evolved, it became fashionable to contrive somewhat unrealistic claims of descent from a roman family settled in the lagoons sometime in antiquity: The official Badoer family tree traces their origins to the Gens Ursia, and in the early tenth century there is indeed record of one Ursus Badovarius applying for a subsidy when raving Maygar hordes devastated his land somewhere near Altino at the northern edge of the Venetian lagoon. That area between the mouth of the river Sile and the fortified town of Eraclea was one of the primary settlement areas for Byzantine soldiers, so I suppose the claim is realistic, but really we're taking the Badoer on their word here. The Dandolo family also traces their lineage back to the roman gens Ursia, specifically from Orso Ipato and his son Teodado Ipato, who were byzantine military officers when the Northeastern Italian lagoons were a Byzantine protectorate. Although the "authorized" Dandolo family tree finds a way to work around it, that there is a two-hundred year gap in the paper trail between Teodado Ipato and the next Dandolo, one Domenico; a Venetian merchant active in Costantinople unremarkable apart from having somehow smuggled the remains of St. Tarasius from Costantinople all the way to the Basilica of St. Zaccaria in Venice.
The examples among Venetian families go on; were the Contarini descended from the roman Aureli Cotta as they claim? We don't know, the first we hear of them is a jurist in the early ninth century underwriting a will. And the Giustiniani claim to trace their heritage to Emperor Justinian! We have spotty documentation of a byzantine family called Giustiniani previously settled in Istria that arrive in Venice sometime before the eleventh century, but that's it. The point is that the settlement of byzantine soldiers in the vicinity of Venice left a mark so deep it influenced the identity that Venetians constructed for themselves.
Edits: Why do I subconsciously capitalize so many adjectives?!