was there something special about the legal environment of Florence at the time that allowed them to thrive?
Indeed the Medici bank, actually all banks of that time, had a physical location. The Medici's location was located near what was then the Cavalcanti palace, near the wool markets. The word "bank" actually comes from the old Italian word "Banca" which means bench or table, in reference to where the bankers would count out their coin.
The interesting thing about the early banks is that they did not charge interest in the traditional sense, but they would charge what we would understand as service fees for services such as cashing out debts or money changing.
Fundamental to the rise of capitalism was the rise of the negotiable instrument. A promissory note or bill of exchange that stated a party would pay a stated amount to the Holder, either on a given day or on demand. The reason they are referred to as "negotiable" is because the Payee, the person receiving the money, can be transferred to another. The modern terms are Endorser and Endorsee.
One of the ideas that would lead to the rise of capitalism is the realization that a good debt has value in and of itself. The service the banks of that era provided was providing liquidity, the ability to turn an asset into cash. If a merchant needed cash immediately, but all of their available assets were in the form of debts, the banks of this era would accept the negotiable instrument as the Endorsee, and pay cash to the merchant at a reduced amount as a service and risk fee, and then pocket the difference.
This allowed them to avoid usury laws, because technically they were not adding a percentage onto the repayment of a debt, they were simply receiving compensation for a financial service proportionate to the amount that was being cashed out.
More particualr to the Medici themselves, and one of the factors that allowed their rise was the fact that they had standard paperwork. While the Medici did not invent the concept, they popularized a concept known as Double-Entry Bookkeeping, for every transaction usually two or more actions occur. If I lend you money, it needs to come out of my account. Therefore, the lending of the money to you, credit, and the withdraw of said money from my account, debit, is both recorded. Simple concept, but if you've ever looked at an accounts spreadsheet, you'll know how fast numbers rack up, and having numbers corroborate each other is key to keeping your accounts in order.
Finally, the rise of the Medici was not particular to anything to do with Florentine law, or to be entirely honest anything to do with Florence in general. That being said, Florence was indeed booming and was a good place to do business. The Medici understood the importance of independent branches. Similar to how corporate umbrella companies or conglomerates work today, each branch of the bank was its own entity, and while they would shift funds to each other as needed, their accounts remained separate. Therefore, if one branch were to collapse, the rest would survive and not have their accounts severely harmed. Or, even the nature of Italian politics, if one branch were to be banished from a city-state, they rest would continue on as normal.
If you want to read more about the history of banking or finance in general, The Ascent of Money from Niall Ferguson provides a fantastic introduction.
edit -
this post from /u/DeSoulis also covers the concept of interest and usury very well.
So, the thing to remember about the great "banking" houses of Florence (and elsewhere in Italy) is that they were not banks as we would understand them today.
Pulling from Raymond de Roover's old (but still useful) The Medici Bank: Its Organization, Management, Operations, and Decline, there are several different institutions that were called banchi, and they collectively filled not only the social functions of a modern bank, but others as well.
So, in the fifteenth century, you have several different credit institutions. The banchi di pegno, banchi minuto, banchi in mercato, and banchi grossi. The first were pawnshops. They gave small scale loans based on predges of personal property at about 20 percent per year. I have seen lots of questions about banks and the way the Medici and other related institutions operated in terms of modern banking, and I think pawnshops played a crucial role that modern people interested in history tend to forget.
Then there is the banco a minuto, about which de Roover questions whether or not we could even consider them as a bank. They essentially sold jewelry on an installment plan. Now, I want to set De Roover a side for a moment to dwell on this point and the idea of medieval wealth. In the modern age, we are perfectly comfortable with wealth being stored in bank accounts and what is essentially imaginary money. In reality, a variety of different objects were not only functional, but served as objects that served value. You see this in wills and records of inheritance. Beds and bedframes, clothes especially, and, of course, jewelry. These purchases were legitimate investments for individuals.
Next you have the banchi in mercato. This is what u/SweatCleansTheSuit is essentially talking about. INstitutionally they have their origins at the semi-regular "fairs" of Europe. They did not get profits from "convenience fees" per se, but by concealing profits in exchange rates. This is the institution where one could get a promissory note, but that didn't come until later in the Middle Ages. In the 11th century checks were unknown and transfer orders were given by word of mouth. These are transfer and deposit banks. These eventually became larger institution and more "official", but these ARE NOT the Medici bank.
Now, it is important to realize that the Medici WERE NOT moneychangers. I restate this, because people see things like "Medici Bank" and they assume that this is what they did. Now, they maybe played around with aspects of this business, but their main role was something different. The Medici, and their antecedents—Bardi, Peruzzi, etc—were members of the group banchi grossi, the great banks.
The Grossi were traders as much as bankers, and they "combined foreign trade and dealings in exchange—not petty exchange of foreign for domestic coins, but trade in bills of exchange (cambium per litteras). To most bankers IT WAS LESS IMPORTANT [emphasis mine] than the trade in commodities. Even the Medici, the most prominent firm of the merchant bankers in Florence, emphasized trade rather than banking (de Roover).
There is also a misconception about the importance of spices and luxury goods. These objects undoubtedly were valuable, and lots of money were made from their sale, but these banking houses made the bulk of their money from wholesale goods—grain, lumber, etc. Edwin Hunt's Medieval Super-Companies is an excellent explanation of these institutions. This book in particular examines the Bardi, Peruzzi, and Acciaiuoli, who all collapsed with the collapse of the bulk goods market in the mid 14th century (bad harvest regionally in Europe and the Mediterranean, along with the demographic collapse ot the plague). Each of these banks dealt in bulk goods, luxury goods, and lent sums of money to European monarchs. These people would not take Joe Merchant on as a client.
There was a central nerve center of the bank, that was the public/private space of the Medici palace, which ran this entire operation. The best way to understand how this stuff worked without getting bogged down in technicalities would honestly be Iris Origo's The Merchant of Prato, which is a fun biography of Francesco di Marco Datini, the founder of one of these family firms that dealt in bulk goods.
First, let's address exactly what usury was and how it was "banned". Ecclesiastical bans on usury began with theological interpretations that charging usury was equivalent to theft in the 11th century. The actual laws were mostly in place by the 13th century.
The argument fundamentally ran that usury was double charging someone, that you could charge someone for the use of something (a loan) or to receive something (a sale) but not both. In other words, you could not sell someone a loaf of bread and then charge them for the privilege of eating it. Likewise, you could not charge someone for a loan and for using the loan. Note this means that you can charge them for taking a loan. But you can't charge them for the use of the loan. Thus the term 'usury'. This was thus more similar to the modern Islamic concept of usury than its popularly imagined version.
Likewise, it was never interpreted to be a ban on investment. There were thirteen safe harbors (to use a modern term) against usury under ecclesiastical rules. One of them was any investment where the creditor and debtor shared risk, explicitly facilitating investment. And all this meant that ecclesiastical usury laws represented regulation on markets that continued to operate. Even where there were explicit bans, such as the Florentine ban on certain kinds of predatory lending, the actual operation appears to have been closer to a licensing and regulation scheme than an actual ban.
Usury laws didn't destroy the banking sector virtually anywhere in Europe, nor was that their intention. That destruction is much more characteristic of the early modern period, where centralized economies under absolutist rulers often drove the local banking sectors to extinction. (A fact that would come back to bite them in the behind pretty quickly and arguably continued to have effects into the 20th century.
The fundamental activities of the Medici bank were taking deposits and reinvesting them in various ways and transporting money. The Papacy had a great need to bring in money from all over Europe and the Medici were one of many merchants they used for the purpose. The Medicis charged a small fee for this. Much more importantly, this gave them contact with the wealthy church hierarchy and a trade network that extended pretty far. I'm not underplaying it when I say they charged a small fee: the profits from collecting Papal money from dioceses were very small. They supplemented it by transporting various goods and selling them. For example, they would often bring the Pope silk along with his tax revenues. Since the Pope (by definition) had just received a lot of money he was more likely to be in the market for luxury goods.
These contacts, with the Papal court and other ecclesiastical persons, meant they also had contact with a lot of relatively wealthy people. These people invested their wealth, naturally. And while real estate was the traditional investment of the European upper class, investing with the Medicis helped to spread risk in case of bad times in the agricultural or rental market. The Medicis were also tight-lipped about their accounts, making them attractive for people who were either corrupt or didn't want to look as wealthy as they were. It was very easy to conceal how much money the Medicis were holding for you. It was very hard to conceal how much land you owned. (Likewise, it's a lot easier to confiscate land than money in a bank. Especially if the bank won't cooperate.)
This money was then invested in various operations, most famously the wool manufactories in Florence. They also commonly invested in commodities. And there were a few other activities, like money speculation. In general, the Medici Bank looked to make a profit however it could through financial means. And this business, of basically private equity, grew to dwarf all the others during the height of the bank.
So the Medici Bank operated more like a modern private equity firm than a modern retail bank. No one walked into the Medici bank to deposit their weekly paycheck or take out a mortgage. (It would have been difficult to do so anyway: neither paychecks or mortgages existed yet.) The bank invested in various businesses more than generating loans. Likewise, because the risk was shared all through the chain (the wool manufactory, and thus the Medicis, and thus the person banking with the Medicis, could all lose money) it was not considered usury.
In fact, their loan business never appears to have been very successful. The bank interacted with loan debt in two major ways: firstly, they leveraged themselves to invest in their various businesses etc. Secondly, they sometimes made loans to various grandees, usually monarchs or politicians, often in exchange for concessions. For example, they once made an (unprofitable) loan to the Duke of Burgundy in exchange for the right to collect certain tolls until the loan was repaid. The latter appears to have been a problem as much as a benefit and probably led to the demise of their Northern European branches. The former had the effect (as leveraging does) of amplifying the effects in whatever direction they happened to take. By the end of the bank, it was part of why they could not recover from shocks that were weathered by healthier banks.
The bank was structured as a series of independent entities or partnerships. Each branch was structured as a partnership where the Florentine branch held significant equity. However, the local head was entitled to a greater share of profits than their titular equity share would have allowed. These were then repeatedly dissolved and renegotiated as a way of taking money out of the business. Each of these banks would have, at most, ten employees but would employ people through other entities. So, for example, if the London branch invested in a wool export business those people would not be employees of the bank but of the wool export business. The degree of latitude each partner had was generated by negotiation between the Florentine and local branch, with more successful governors generally getting wider latitude. These were semi-standard, in that the Florentine bank had preferred terms, but otherwise each branch operated basically on its own terms. For example, the records of the Cologne branch were kept in German and the Luebeck branch in Italian. However, they did insist on a form of standardized accounting.
Indeed, it most closely resembled a franchise model. The local governor had to put up their own money and then received an additional investment by the Medici bank, and got the right to use the Medici bank's symbol and reputation. This was not the norm at the time but was chosen for strategic and financial reasons, allowing the Medici to have a wider network that was more difficult to uproot or take over at the cost of some degree of control.
The banks did have physical locations. These varied but very often being one of the ten or so employees was a cushy gig, with high pay, relatively luxurious corporate housing, and proximity to the great and powerful. They did not have any equity stake in the bank, though they were often given bonuses for good years. Likewise, it was a good way to get established in banking and eventually strike out on their own.
As for how they made lending decisions, this varied. It was only towards latter periods where the Florentine branch started to introduce basic rules and tests, largely because some branch governors had lost money. Determining creditworthiness in the medieval era was extremely difficult and could take up a post on its own. However, we can say pretty decisively that the Medici were not very good at it. Indeed, there were long periods where loans were almost always made seeking concessions or political favors rather than expecting to make the money back.
I can get into more granular detail if someone has specific questions.
From Il Cardinale Ostiense, The Catholic Encyclopedia, Summa Theological (specifically "On Cheating"), The Medici Bank and the World of Florentine Capitalism, The Development of Accounting Prior to Luca Pacioli, and The Medici Bank.