According to Gordon Wenham, there is a distinction between law and ethics in the Hebrew Bible (see here). “The law represents the floor below which human behaviour must not sink. The ethical ceiling is as high as heaven itself, for a key principle of biblical ethics is the imitation of God” (“The Gap between Law and Ethics,” 25-26). The distinction being made here is between a basic ethical standard and an absolute ethical foundation. Law functions within ancient Israelite society as a component of their ethical framework, but the imperative to imitate the character of God is the foundational principle for Hebrew Bible ethics.
This absolute distinction between law as minimum standard and imitation of God as paradigmatic principle is where I find Wenham unpersuasive. Undoubtedly, imitation of God is an important foundational principle in Hebrew Bible ethics (see here), but it is not accurate to speak of imitation as the ceiling and law as the floor in every text. In Genesis 3, for example, the human couple is expelled from the garden because of their (successful) efforts to become “like God/deities” (Gen 3:22; cf. 3:5-6) and the disobedience necessary to accomplish this. In Genesis 3, imitation is undesirable, and obedience is the ethical standard.
For other places where the imitation of God does not represent the ethical ceiling of the Hebrew Bible, there is a most interesting discussion that has taken place between Cyril Rodd, John Barton, and Walter Houston. In essence, Rodd is very skeptical about the concept (do we imitate God or do we create God in our image?), and believes there is much about God in the Hebrew Bible that does not warrant imitation. Barton agrees that the Hebrew Bible entertains the “non-imitation of God,” but still maintains the legitimacy of the imitation principle. Houston, much in the same vein, suggests where the principle of imitation is more and less appropriate, and where it is less appropriate, he argues that “God (at least, the character YHWH in Exodus) may be ‘ethical’, but the ethics that apply to him, because he is God, are not the same as apply to most human beings” (23). This discussion is ripe for further study!
C. S. Rodd, Glimpses of a Strange Land: Studies in Old Testament Ethics. Edinburgh (T&T Clark, 2001), 65-76; J. Barton, “Imitation of God in the Old Testament,” in The God of Israel, (University of Cambridge Oriental Publications 64; Cambridge: Cambridge University Press, 2007), 35–46; W. J. Houston, “The Character of YHWH and the Ethics of the Old Testament: Is Imitatio Dei Appropriate?” Journal of Theological Studies 58, no. 1 (2007): 1–25.