how did it stay competitive with West Germany, which would be free of West Berlin's particular logistical challenges? Or were they being directly subsidized by the Federal Republic and/or the western allies, for political reasons?
Yes. There was a Berlinförderungsgesetz (Law of Promotion of Berlin).
Daher entschied sich die Bundesregierung, die Wirtschaft Berlins durch Bürgschaften und vor allem durch Umsatzsteuersubventionen zu begünstigen. Die Umsatzsteuer wurde um drei Prozentpunkte verringert
Rough translation:
Therefore, the federal government decided to promote the economy of Berlin through guarantees and primarily through sales tax subsidies. The sales tax was reduced by three percentage points
I remember myself, when I worked in a factory in the eighties (West-Germany) that we send semi finished products to West-Berlin. When I asked why we don't finish the work ourself, the answer was: With some work in Berlin we get tax advantages.
Another German Wikipedia-Quote about the economy of West-Berlin:
In den Folgejahren wurde West-Berlin als Industriestandort durch die Umsiedlung ganzer Betriebe, sowie die vielerorts drastische Reduzierung der Arbeitsplätze (nicht nur durch Rationalisierung) geschwächt. Der West-Berliner Arbeitsmarkt wurde immer stärker von der öffentlichen Beschäftigung, der Wissenschaft und dem Dienstleistungssektor geprägt.
Translation:
In subsequent years (1), West Berlin was weakened as an industrial location through the relocation of entire companies, as well as many places drastic reduction of jobs (not only through rationalization). The West Berlin labor market has been increasingly dominated by the public employment, science and the service sector.
(1) After the building of the Berlin Wall (13. August 1961), when commuter could not pass the border any longer.
So, there were in fact negative effects. But there was a big support of public services.
In the Berlinische Monatsschrift Heft 6/2001 was a German article Nach Abschottung die Zitterprämie about economics and demographics while the wall time.
Maybe you find more information in the translated version.
Some quotes:
Most of the increase in wages and salaries of all workers and the income of self-employed and the employers' profits caused the possessed by federal law Berlin-promotion. She was by supplements for workers, once popularly known dither premium, as well as tax deductions.
...Every year, were among the immigrants and young men who wanted to avoid in this way the service in the Bundeswehr. ... Alarm signal and at the same time signs of structural weakness of the economy of West Berlin: Production of electrical industry stagnated, the the power industry fell by 10 percent.
The craft made the wall a sustained decrease in performance. Thus, the distance to the West German craft is enlarged on nearly 25 percent
West Berlin was in August 1961, both insular and cosmopolitan part of the city. She could only with enormous subsidies from the Federal Republic to maintain its existence and offer the residents an acceptable material existence. No comparable settlement area, no comparable business location has ever existed over a period of more than 28 years as an enclave in a non-homogenous, politically hostile surroundings. No comparable city has ever received such high financial and material assistance from outside to live. ...
Assuming federal aid and preferences as well as the allowances under the Berlin Promotion Act together, you come to about 950 billion DM, ie approximately one trillion DM. The freedom of West Berlin had an almost astronomical price.