Taking amphetamines or cocaine could stop cells in key areas of the brain linking up normally.
There are worries about long-term amphetamine use
This, warn experts, could explain why it is feared that long term use of the drugs could affect memory or mood.
Rats would be expected to generate new brain "connections" if put in a stimulating environment - but after being given drugs this did not happen.
However, experts have warned that results in rat brains may not correspond exactly to human brains.
While there are concerns about the long-term effects of amphetamines and cocaine on the brain, it remains a controversial area.
While some researchers point to studies which suggest mood problems in some users, others maintain that firm evidence for a link has still not emerged.
The latest research was carried out by scientists from the University of Lethbridge in Canada.
It looked at brain connections in part of the brain called the nucleus accumbens, and another called the neocortex.
The nucleus accumbens has been linked by other studies to mood, while the neocortex has some bearing on memory, it is thought.
The rats were all put into a "stimulating" environment - cages with plenty of ramps, wheels and tunnels.
However, some of them had been repeatedly given either cocaine or amphetamine a few months earlier.
Animals not given the drugs showed an expected response to their "exciting" new home - their brains showed signs of increased connections between brain cells in the key areas.
However, the rats who had been given either drug showed no sign of these changes.
The researchers said: "Perhaps the most important issue raised by the current study concerns the long-term consequences of drug use for behaviour and psychological function.
"At least some of the cognitive or behavioural advantages that accrue with experience may be diminished as a function of prior exposure to psycho-stimulant drugs.
"We have no direct evidence this is the case, but there is accumulating evidence that amphetamine and cocaine addicts have numerous neuropsychological deficits."
A British expert said that rat studies were not necessarily the best way of predicting what was going on in the human brain.
Professor Dai Stephens, from the University of Sussex, told BBC News Online: "You have to be rather careful that the doses and treatments given to the animals are comparable to those taken by human users of the drugs."
He said that in addition, rats kept in ordinary laboratory cages before being put into their "enhanced" environment might be considered understimulated prior to the experiment - and therefore not necessarily ideal for comparison with humans.
Lesley King-Lewis, chief executive of the UK charity Action on Addiction said: "This research highlights how little we know about the detrimental consequences of stimulant drug use.
"It goes some way to explaining the effects on mood and memory we are already aware of.
"However, it is unclear how applicable research in rats is to humans, and more work is needed in this area to determine what goes on in human brains.
"What is apparent from this research is that greater awareness is needed of the serious neuropsychological effects of stimulant drugs, to halt the growing use of stimulant drugs in the UK."
The study was published in the journal Proceedings of the National Academy of Sciences.