As Hermione, herself points out, the only danger with the fake coins used for communication among the DA (Dumbledore's Army) would be that someone might actually spend them. This brings up the possibility of using these Galleons to your advantage. While goblins can determine if a Galleon is fake, the regular wizard probably doesn't check for that kind of thing. Therefore, shouldn't those Galleons have been illegal?
I don't have an exactly canon answer but possible a practical one.
At first I wondered if they were fake, or if she just enchanted real ones; besides it being expensive, I found the following quote:
She gave each of the members of the D.A. a fake Galleon (Ron became very excited when he first saw the basket and was convinced she was actually giving out gold).
That seems to confirm that they were fake.. but that doesn't necessarily mean they are illegal. Counterfeit coins that are not meant to be used as coinage aren't exactly illegal; search the net, and you will find many 'Copy of 1XXX' coin sales. (Doing a quick search on a auction site, I found "Copy Silver Clad 1891-CC Morgan Silver Dollar - Rare Carson City Date" on the first page.)
As far as I know, they're not technically illegal if you neither create them, possess them, nor distribute them with the intent that they enter the monetary system as the coins they appear to be. (Crimes tends to require an intent; sometimes it can assumed to be inherent in the object itself, but rarely -- usually it's what use you put it to or can be shown to intend to put it to that matters.)
A fine point, I'll admit, but it's also what allows parody money (like the $1,000,000 bills you can find at joke shops) and similar items to exist. Usually they are done in such a way that it is clear at a glance that they are not real. Prop money in Hollywood is similar, but visibly more believable; it can be told from the real thing, but not at a quick glance.
The statutes in the Muggle world tend to take a form such as:
"every person who possesses or receives, with the intent to pass or facilitate the passage or utterance of any forged, altered, or counterfeit items, [...] with the intent to defraud, knowing the same to be forged, altered, or counterfeit, is guilty of forgery.”
California Penal code §475(a) (forgery).
Note -- 'Pass or facilitate the passage or utterance of' -- that's talking about passing them off as the real thing, or helping others to do so and 'with the intent to defraud.'
Or, for a UK example: (since, as Rand al'Thor points out, the books take place in the UK.)
[Emphasis added by me]
"14. It is an offence for a person to make a counterfeit of a currency note or of a protected coin, intending that he or another shall pass or tender it as genuine."
Forgery and Counterfeiting Act 1981,
Mere possession isn't usually enough; in most places it has to be accompanied by criminal intent. (See: US v Cardillo and US v Ratner for examples of trying to prove intent, as mere possession wasn't enough.) That said, it can be pretty hard to explain why you have fake money.
Again, looking at the UK Forgery and Counterfeiting Act, Intent is important:
[Emphasis added by me]
"15 (1)It is an offence for a person—
(a)to pass or tender as genuine any thing which is, and which he knows or believes to be, a counterfeit of a currency note or of a protected coin"
Were Hermione caught with them she might have a lot of explaining to do, but I don't think it's technically illegal. That said, absent a book on Wizard Law, I'm not sure we can know. (Unless it's directly addressed, in one of the books, and I've just forgotten it.)
Caveat - I'm not a lawyer; I don't even play one on TV.
No, they were not illegal to create or possess.
While they may be illegal to spend, there is evidence that it is legal to create. In Goblet of Fire, Leprechauns distribute fake gold coins in the presence of the highest members of the Ministry of Magic:
Next moment, what seemed to be a great green-and-gold comet came zooming into the stadium. It did one circuit of the stadium, then split into two smaller comets, each hurtling toward the goal posts. A rainbow arced suddenly across the field, connecting the two balls of light. The crowd oooohed and aaaaahed, as though at a fireworks display. Now the rainbow faded and the balls of light reunited and merged; they had formed a great shimmering shamrock, which rose up into the sky and began to soar over the stands. Something like golden rain seemed to be falling from it — “Excellent!” yelled Ron as the shamrock soared over them, and heavy gold coins rained from it, bouncing off their heads and seats. “Leprechauns!” said Mr. Weasley over the tumultuous applause of the crowd, many of whom were still fighting and rummaging around under their chairs to retrieve the gold.
The Minister of Magic himself was present at the event:
The box filled gradually around them over the next half hour. Mr. Weasley kept shaking hands with people who were obviously very important wizards. Percy jumped to his feet so often that he looked as though he were trying to sit on a hedgehog. When Cornelius Fudge, the Minister of Magic himself, arrived, Percy bowed so low that his glasses fell off and shattered.
These coins were confusable with real currency, as we see:
“Well, the git paid us in leprechaun gold he’d caught from the Irish mascots.” “So?” “So,” said Fred impatiently, “it vanished, didn’t it? By next morning, it had gone!”
“Leprechauns!” said Mr. Weasley over the tumultuous applause of the crowd, many of whom were still fighting and rummaging around under their chairs to retrieve the gold.
“There you go,” Ron yelled happily, stuffing a fistful of gold coins into Harry’s hand, “for the Omnioculars! Now you’ve got to buy me a Christmas present, ha!”
Yet this showering of fake gold was perfectly legal and done in full compliance with Ministry officials. Although they may not look like Galleons, they definitely looked enough like real currency to confuse people and it was still legal. Hence, it is safe to assume the Ministry does not have any strong anti-counterfeit laws on the books.