A team that I am working on has gotten into the habit of using tags in random places in the body of our HTML pages. For example:
As several people mentioned, it's valid, it works, and it is widely used.
Best practices as far as semantics recommend (or at least used to recommend) is placing script tags inside of the header.
More modern best practices which take performance into account recommend placing script tags (external and inline) at the bottom right before the body tag, to allow the markup to render completely before any JavaScript code executes.
For easier to understand and maintainable code, "unobtrusive JavaScript" is recommended, where the code is in an external file and binds events to the DOM (Google unobtrusive JavaScript).
One case where it's useful to have JavaScript inline is to initialize variables with values that only exists server side, which will then later be used by the external JavaScript code.