What is law? A law must have a consequence (e.g. punishment). In the case of natural law, gravity keeps us on the ground. On earth, we measure the consequence of the law of gravity as a force (9.81 meters per second per second). We can use this force to our benefit (e.g. cracking open a walnut by dropping a bowling ball on it) or to our detriment (jumping off a building).
For the purpose of this discussion I will confine my political ideas to the US constitution and laws created by its states. Politically speaking, the US creates laws in congress and we execute or enforce these laws through the administration of the executive branch. To enable readers to follow my logic I submit the following sequence of events: If I run a stop sign, I could get ticketed. If I don't pay the fine and I am pulled over again, I could be arrested. If I resist arrest, the cop could use force to detain me. If I overcome the cop, take his gun, and run, I could be hunted down for assault and possibly shot at were I to use the weapon against the cops. Ultimately, the political consequence of breaking the law is the loss of life to some degree or another. It may seem a bit of a stretch to say that the reason that I pay a traffic ticket is to preserve my life, however this is my position and I welcome the reader to challenge it.
Establishing that laws must have consequences, justice is the enforcement of punishment equal to the degree of violation of another person's rights (an eye for an eye). The authors of the constitution declared life, liberty, and the pursuit of happiness as unalienable rights and submitted that these rights were self-evident. Using the rights as the basis for my arguments, my freedom stops where yours begins and this line is drawn through relationships. To illustrate this point, consensual sex and rape are the same in performance however, the latter violates a person's right to pursue their own happiness. On a smaller scale, if my brother grabbed a $10 bill without asking me while driving my car to buy himself some lunch it would not be the same as a stranger grabbing the $10 for themselves because of relationship. To answer the question, "[W]hat is it that determines an action is legal or illegal?" I submit to you that it is a mutual agreement between two parties.
Consequently, what should be legal is ultimately determined by a contract or covenant. Politically speaking, the contract that exists between us and our government is the constitution. Just as the state constitution can not prescribe by law anything that violates federal law we can not legally make contracts with one another that violate the laws of our county and state, etc.
It should be noted that drugs, gambling, and prostitution are already legal to some degree and depending where you are. The term legalization is interpreted as the expansion of what is already legal. In light of the aforementioned, I will attempt to address the legalization of drugs. However, there is one more level of depth I must add to the above. In its attempt to protect the people whom it represents, the state must protect us from the social consequences of a behavior without creating a measure of correction that the enforcement thereof exceeds the cost of the unbridled behavior.
Should it be made popular by way of the democratic process, I advocate the controlled legalization of all drugs so long as the controls in place are equal to the degree of risk placed upon society. If someone wants to experiment with a chemical it should be medically prescribed and supervised. The cost of administration should be offset by the consumer and the drug should be taxed to offset the cost of government auditing (by the FDA perhaps). Arguably, the cost of the drug could potentially be more than illegal methods of procurement however, the costs may out weigh the obvious risks (e.g. purity, theft, assault, etc). Additionally, if the anticipated decrease in cost of waging war on drugs is realized (to include the cost of counseling and hospitalization), this savings could be applied to the cost of government monitoring and thus decrease the cost of the drug itself. The drugs should be administered by a Psychiatrist who can offer counseling in conjunction with the drug and who would submit significant findings to peers for review and potentially advance the body of science itself. I propose that the increase in the number of curious individuals who wanted to experiment with drugs would be greatly offset by a decrease in the number of drug abusers. Abuse here, is defined as usage beyond a consumers ability to function in society.
Even without any monitoring at all, there are still some laws we can not escape. The damage that drug abuse does to the body is based on irrevocable natural laws and this is the risk taken on by the consumer. The political laws that exist today are an attempt to protect us from the social consequence of operating in a universe governed by natural law. In other words, even in total anarchy Rousseau is correct in saying "Man is free, but everywhere he is in chains". It would be a fun thought exercise to create a government based on the idea of being immortal.