How are you determining the loss? The colonies may have been in economic decline, but the colonizing country and its companies greatly benefited.
In Lebanon, for example, France used the region as a captured market for French goods and companies, and as a base from which to draw raw materials. French economic experts laid out fiscal, land ownership, and monetary changes. French companies were granted special privileges, such as Companie Auto-Routiere du Levant and D.H.P. Railway Company. These were both awarded 'kilometric guarantees', and the former was given tax exemptions. France also put up high tariff barriers for transactions between French Mandatory Lebanon and Syria in order to promote increased trade with France. In 1933 General Count Camien de Martel was appointed High Commissioner for French Lebanon. In 1934 he issued decree No. 275/LR in which the trade and manufacture of tobacco was granted as a monopoly to a French company for the span of 25 years. A similar decree had already existed targeting only Muslim areas of Lebanon, but in 1934 the Christian areas of Mount Lebanon were included as well for the first time (France had a different taxation system for the majority Christian areas from the Muslim areas). This angered Patriarch Arida of the Maronite Church enough that he publicly took a stance against de Martel, a first for the Maronite Church. It would lead to massive protests across Lebanon and exacerbated the land ownership problem in rural areas. In 1924, Law No. 2500 was passed that enforced the parcellation of collectively managed farmlands. This allowed large landowners to buy up more plots. So in tandem with the tobacco laws, the strength of large landowners on agricultural lands was increased, and the farming of tobacco also greatly increased. Until the 1960s, 70% of southern Lebanon's farmlands were used to grow tobacco. I highly recommend the book Inventing Lebanon, by Kais Firro, that covers all this extensively.
Regarding Egypt, its economy was in decline through the entire period of British control, despite Britain and British companies benefiting greatly. First, a little background:
There was economic competition all across Europe after the Napoleonic wars. Britain and France in the 1800s had both raised tariffs on each other's goods. This meant that Britain was exporting more goods in 1839 to Aleppo than it was to France. (Marsot, p233). Egypt in the mid-1800s had split off from the Ottoman empire and had formed an empire by taking the Levantine coast (what's today Palestine, Lebanon, Syria, etc) and what's today western Saudi Arabia. Egypt also controlled Sudan and took parts of Libya and also occupied Greece. It's out of the scope of this comment, but Britain, France, the Austro-Hungarian Empire, and Czarist Russia all allied together and sent their navies and armies to threaten Muhammad Ali pasha of Egypt. The Ottoman empire eventually signs the Treaty of Balta Liman. Egypt goes from being one of the foremost industralizing countries in the world, to being essentially an agriculture-based economy. The economy of the Ottoman empire itself becomes crippled. The French ambassador to the Ottoman Empire calls it "a complete economic revolution." Egypt and Syria are subsumed in this treaty and become bread baskets for France and Britain, with the taxes on some items reduced tenfold, and as with Lebanon in the 1920s-40s during the French Mandate period, both Egypt and Syria become captured markets for French and British finished goods. British advisers and economic experts wield increasing power in Egypt.
In the following decades, the Khedive Ismail of Egypt borrows heavily from Britain. Egypt is at war in Eritrea, Sudan, and Ethiopia, and is also expending a ton of money on the building of the Suez Canal, and so he borrows extensively from British and French banks to keep the war going. He borrows at rates of 12-26% interest. He makes purchases from British contractors on projects such as harbours, railroad construction, waterworks, etc. where he was being charged 3-4x the price. He begins to borrow against state-owned lands while watching the industrialization halt and economy crumble. Egypt's army after 1841 goes from 100,000 to a legally mandated 18,000 troops.
In 1875 he sells Egypt's share in the Suez Canal to the British government. He is also advised by the British government to petition the Ottoman Sultan to make his own debt equivalent to Egypt's national debt. Britain sends a 5-man team to take over control of Egypt's economy. France also sends an economic commissioner. The British press at this time openly talks about how Egypt will fall into Britain's hands when the economy collapses. Charles Wilson becomes Egypt's Minister of Finance, and a Frenchman becomes Minister for Public Works. In order to pay back the debts an aggressive takeover of public goods takes place, and something like 80% of Egypt's government revenue goes to its creditors. Forced purchase of crops for half their price takes place, public servants' wages go unpaid, and there's a small famine in the late 1870s. A 2nd British commission of the economy takes over under Rivers-Wilson and Evelyn Baring. There's no reduction of interest rates or taxes. Instead, the Finance Ministry goes to Rivers Wilson, France gets the Ministry for Public Works, Italy gets the Ministry of Justice, and Austria gets the Ministory of Education. Egypt's economy continues to be plundered by the creditors, and extreme poverty spreads. A revolt breaks out, and 40,000 British troops are brought in to quell it. After Britain formally takes control after deposing the Khedive Ismail, they pass a series of policies that Ismail had previously proposed previously, such as creating a debt payment schedule and limiting interest rates to 4%.
Throughout this period, the Egyptian economy was tanking, but Britain and British companies benefited immensely. In the paper 'Egypt's Growth Performance Under Economic Liberalism' by Tarik Yousef, he shows that between 1886–1945, almost the entire period of British rule over Egypt, a period when the National Bank of Egypt was owned by Britain, there was no growth whatsoever in income per capita.
Some books I like on this subject are: Egypt In the Reign of Muhammad Ali, by Afaf Lutfi Marsot, Egypt's Ruin: A Financial and Administrative Record, by Theodore Rothstein, Egypt on the Brink by Tarek Osman, All the Pasha's Men by Khaled Fahmy, and the paper by Tarik Yousef that I cited above.
EDIT: removed my link to a thread on India because because most of the thread has been deleted
I am really curious about your metrics and would love it if you could lay them out for me.
Aside from India, Algeria and Congoese rubber, which /u/khosikulu have already gone into detail, there seem to be glaring omissions including Peruvian silver, Chilean saltpeter, Maluku spices, Canadian fur, American tobacco/cotton and West Indies sugar. These have not only shaped the colonizing nation's fortunes, identities and economy but could upend the world order at times. Peruvian silver, for instance, not only funded Habsburg hegemony in Europe but crashed the Ming economy; silver import volatility and the collapse of their currency is almost always listed among the main reasons Ming fell in 1644.
An economy is not a tally of the trade balance, as can be seen by the phasing out of mercantilism on the world stage. This means that the true value of acquiring commodities at a discount and selling at a fixed premium to your dominions, along with the entailing economies of scale and relative advantage amongst the other colonial powers are not properly reflected by "exports minus imports." To put simply, it is not only what you get out of the colony in terms of resources, but also the exclusive right to sell and the exponential growth that comes from carrying out the transaction over and over, feeding into growing assets and capital which can be further leveraged for more profit, assets and capital.
Another way to turn the "wheel of commerce" is through capitalizing on the untapped production capacities via governments spending; Keynes prescribes incurring debts even if to "dig holes in the ground" as means of get out of an economic funk. And the go-to outlet for production is war rather than holes, with WW2 Japan, Germany and Italy being great examples.
Even before WW2, Japan had a taste for burning through supply with the demands of war. In 1893, right before the Sino-Japanese War, Japan's government budget sat at 84,600,000 yen with 27% of it going to military spending. In 1894, the budgets rose to 185,300,000 and 69%. The year after, the budget was 178,600,000 and 66%. When Qing China eventually sued for peace, Japan got back 4 years' worth of the national budget plus Taiwan and Liaodong, the latter of which was given back due to meddling by an alliance of Western powers which, in turn, contributed to further military build-up and a need for more resources- provided by futures targets like Manchuria and the East Indies. This type of "mixed" economy not only provides the direct benefits of security and diplomatic heft but also feeds into infrastructure that allowed Japan to supply the Americans in the Korean War, with the reputation of quality carrying over to their automobile exports.
While there are exceptions made by poor planning, as with Scotland and Panama, there's always an economic basis for investment and replication.