Legal, maybe. Ethical? Not to me. Think of it this way: would you tell your employer you were planning to work two jobs, and put in the minimum effort into them? Would you be above-board and transparent about your conflicting responsibilities and schedules? If not, you're committing fraud: "intentional perversion of truth in order to induce another to part with something of value." (The value, in this case, is the fruits of your labor.) And fraud is most certainly unethical, even if not illegal in this case.
Employees trade their hours for the company's money. If you want to trade deliverables for money, you have to be a contractor on a deliverable-based contract. It's a lot riskier, which is why it pays more... sometimes. If you are in a full-time job, and not putting in full-time hours, you're defrauding your employer.