Not generally. However, if you lived in a place where brown rats are not found in the wild it would be extremely foolish indeed. There are few such places left, but they tend to be remote islands with rich and fragile ecology. One escaped pregnant pet could wipe out several whole species!
In fact I think that one should not keep any other animal which could live wild, but does not occur already in the area. Escaped or released animals have done enormous damage in many parts of the world, eating or competing with the native ones (look at rabbit, fox and cat in Australia, and grey squirrel in mainland Britain).
Even the wrong subspecies can cause great harm -- for example, in the British Isles most of the various native brown trout (originally one or more different types in nearly every river catchment) are replaced now by "ordinary" domesticated strains from fish farms and stocking by anglers.
It's actually illegal in UK to allow any animal to escape which is not already established in the wild. For some species (such as grey squirrel) it's even illegal to release it if you've just caught it, or after you've tended an injured one.
If you want to keep a small rodent, there are often common native ones which make good pets. In the UK, short-tailed (or field) vole is excellent -- tame almost from wild, easy to handle and tolerant of a cage environment -- at least as good as a hamster. Bank vole can be tamed too (but wood mice are much too nervous). Keep voles in a cage with a big slice of grass turf on the floor, regularly replaced -- otherwise like a hamster.
I wouldn't keep a wild brown rat though. They are extremely nervous, and bite and jump much more, so are difficult and dangerous to handle. And they can carry quite nasty diseases.
Remember that some species are legally protected and must not be caught -- for example, hazel dormouse in UK.