Why was Paul allowed to write in jail? We know that Paul was held under some brutal conditions—his feet in stocks in one case. Yet he was still able to write many letters from prison. Was this during some of his "nicer accommodations", or did the ethos of the time allow visitors and outside contact (even as they tortured prisoners)?

In contrast, in the US, when someone has done something pretty offensive (murderers to terrorists), there are controversies about and often restrictions placed on their writings (esp. the ability to publish books, but sometimes more general limitations on outside contact, etc.)
First of all, Paul was the Roman citizen, and during his imprisonment he was been waiting for Caesar's judgment:


  (Acts 25:10-12) Then said Paul, I stand at Caesar's judgment seat, where I ought to be judged (...) I appeal unto Caesar. Then Festus, when he had conferred with the council, answered, Hast thou appealed unto Caesar? unto Caesar shalt thou go. 


His crime was imputed to him not by Roman citizens, but by persons of occupied nation. 

So, this wasn't just imprisonment as for ordinal criminal, but it was something like house arrest before sitting of the court. It was quite comfortable restraint of liberty, so Paul could even preach:


  (Acts 28:16, 30-31) And when we came to Rome, the centurion delivered the
  prisoners to the captain of the guard: but Paul was suffered to dwell by himself with a soldier that kept him. (...) And Paul dwelt two whole years in his own hired house, and received
  all that came in unto him, preaching the kingdom of God, and teaching
  those things which concern the Lord Jesus Christ, with all confidence,
  no man forbidding him.