Critically, the two villages have their own currency. In order to buy Bob's store, the purchasing villager must convert some amount of his currency into Bob's. She does this by selling some of her currency on the open market, converting it to Bob's currency (dollars, apparently).

Ironically, the debt increases based on what Bob does with the money. When purchasing villager brings $100 in capital, that's an inflow. If Bob turned around and bought a business in village B, all we've done is changed names on titles. No net capital flow. But if Bob keeps the money within his village, it gets deployed locally. If it's saved for a rainy day, it's in a bank account somewhere (or stocks, or whatever), and that money gets redeployed as debt someone else owes to the bank that Bob uses. (If he literally stuffs it in a mattress, that's actually deflationary seignorage -- and that doesn't happen at a significant enough scale to matter to international macro... though you could see the gold market as a strange derivative of that impulse.)

So yeah, the debt is created by the lending-on of Bob's newly liquid capital (while the old, embodied capital of his shop still exists). If Bob spends it instead of saving it, the mechanism is a little more abstract, but a balance sheet analysis is pretty simple: Bob just spent $100 that he used to have; that's $100 of extra consumption that was financed by the foreign capital input of the purchaser... the fact that he's not literally in debt isn't the point, since a country's aggregate debt is just everyone's assets in a country minus everyone's obligations; if a net lender reduces her capital on loan, that's the same as a debtor increasing his obligations...

Let's make this less abstract. Let's say the purchaser is Alicia, and she's from Mexico. Her capital is in pesos (she has stores in Mexico, which transact in pesos, so that's what her accrued capital is in). In order to buy Bob's store, she needs to convert to dollars, which she buys on the open market, perhaps by just changing it via her bank, or some simple forex transaction. (Note that the ease of these transactions is probably part of what has changed internationally, to allow these dynamics to dominate.)

The fact that she has to change currency is exactly what drives the dynamic. If Alicia had a US entity, with US-based, dollar-denominated capital, there's no net flow to account for, just a change in paper ownership (though Bob gets to decide how that cash gets allocated now, not Alicia).

But since Alicia represents a foreign capital purchase, her choice to purchase Bob's store is both an explicit capital inflow and an implied investment in the US economy. The explicit allocation is clear: she has converted peso-denominated wealth to US-based (and dollar-denominated) assets. The implicit investment is a function of the overall capital balance: she has effectively, at the margin, pushed $100 of additional capital into the US, by selling assets (or calling in deposits) in pesos, and using the liquid pesos to buy $100. (Note that calling in a deposit is equivalent to calling in a loan, reducing endebtedness in Mexico by the same amount -- though it's obviously mediated by banks.)

If we think of trade as driving exchange rates, we should see a balancing act, where the 'cost' of pesos relative to dollars just went down; by showing excess demand for dollars (to buy US assets, namely Bob's store) and excess supply of pesos (that she had to sell), Alicia is effectively affecting the relative exchange rates of pesos-to-dollars simply by 'voting' on the relative supply and demand. In a normal, trade-driven framework, the dollar would become stronger, purchasing more on the open market, and pesos would become weaker. That would drive up the implied wage of US workers, making US goods more expensive, and making Mexican wages lower (in absolute terms), so Mexican goods are now relatively, and marginally, cheaper. Over time, those price differences would offset the capital flow, because the pricier US goods would theoretically suffer on the open market, and the Mexican goods would look like a relative bargain, so capital would net flow to Mexico to balance the capital flow represented by the purchase of Bob's business.

And that would be a natural framework to understand the transaction, if trade actually drove capital flows. And that's how we answer toy models. But the dominant dynamic in 2017 is that capital flows move independent of trade; I'm thinking of a statistic that Pettis cited (sorry, don't have it at my fingertips), but the total global capital flows are something like 5x what would be necessary to account for cross-border flow of goods and services.

What? Why? Well, because entities on both sides of every border are busy investing and divesting; Alice and her compatriots are also buying US stocks (with converted pesos), as are Bob and his compatriots, selling dollars to buy assets in pesos, reminbi, won, euros.... Do you have international exposure in your 401k? Okay then, you're participating in international capital flows, too.

So the total volume of capital flows dwarfs trade, and we can't honestly expect trade fundamentals to drive exchange rates and capital allocation. That worked for Adam Smith's toy model about English wool and Spanish wine, but it fails today. No, what dominates today is the capital allocation, which is extremely liquid, very fast, highly leveraged, and untethered from productivity fundamentals (or at least, it's not first-order).

So what is the free variable? If international capital allocation is driven by its own dynamics (capital flight from unstable regimes, fleeing 'financial repression', etc), and exchange rates float, how does the US absorb capital flows from the rest of the world? (Again, note the causal inversion: we have a trade deficit in the US because of international capital flows, not the other way around.)

The balance sheet answer is simple, and obvious: we must consume more than we produce, consume more of the world's productivity, financed by capital flow into the US. And that excess consumption is debt, which ends up on someone's balance sheet: the US government (the deficit / national debt), corporate balance sheets (corporate debt, though that's usually returns-driven, so limited by the potential for near-term investment returns), or household debt.

And household debt can be revolving debt (credit cards, the balances are driven higher because foreign capital is implicitly financing lower interest rates), mortgage debt (because home values are driven up by cheaper mortgages, financed again by capital flows), student debt, automotive debt....

I hope I haven't made things murkier.