I think it's something every script author has to decide for himself.
Posting a complete script or a snippet on this forum implies the scripter doesn't mind putting it into the Public Domain. When someone else is re-posting the script, it's considered Good Manners to mention the original author, and possibly the source (forum) he got it from. Then again, as all regular scripters know, Good Manners never have stopped copycats from copying. Anyway, it's their loss -- copying implies they don't know how to do it themselves, and so they are exposed as the frauds they are first time someone asks them to change something in "their" script.
If a scripter writes a custom script on behalf of someone else and does not want to reveal his tricks, he can always ask the requester an e-mail address via a personal message and then send a compiled JSXBIN script. Even so: one of the frequently popping up questions here is "i hav jsxbin how can i edit the source can any1 help me pleez" -- some people Just Don't Seem To Get It.
I don't mind other people looking at my scripts. Most of 'my' advanced tricks I learned from Those Who Went Before Me, so it's nothing unusual -- and, by the way, I assume they don't mind "me" using "their" tricks, because they posted their scripts on public forums too!
Scripting is for me a way to exercise my brain and to test InDesign to the breaking point (often literally). My daily job is formatting plain text for books and scientific journals, and having done that the past (oh god!) twenty years, I can do it in my sleep, so every now and then I need to get my mind off of it and do something challenging.
(As one of the 'regulars' here, at times I receive a copy of a "commercial" script in unencoded form; usually accompagnied by a friendly mail, asking how to perform this-or-that trick. Under NO circumstances I would (knowingly) send such a script to someone else, or copy fragments of it into my own scripts to wow Joe Public with. That's my responsibility to keep it that way.)
I agree with Theunis: what's posted on the web is in the public domain, but authors should always be acknowledged. Passing off someone else's code as your own is pathetic and a display of weakness.
I agree with Theun and Peter.
The one thing I might add is that a few bucks goes a very long way towards showing appreciation (even more than the aknowledgement). Especially when the $ are few and far between...
Anyway I think in case of doubt the reader may be guided to this page to see some examples.